anuragverma108 / SwapReads

This repository is officially part of GirlScript Summer of Code 2024 Extended Edition! SwapReads.com is the go-to online platform for book lovers to connect, swap their favorite reads, and dive into exciting literary journeys.
https://swapreadsconnect.netlify.app/
MIT License
325 stars 671 forks source link

"Refactor JavaScript: Fix event handling, optimize DOM operations, and reduce code duplication" #3768

Open Aayush2308 opened 1 day ago

Aayush2308 commented 1 day ago

Is there an existing issue for this?

What happened?

  1. Inconsistent event listener usage, with some listeners attached outside the DOMContentLoaded event.
  2. Inefficient DOM manipulation methods (e.g., using innerHTML instead of textContent).
  3. Redundant code in the "Learn More" and "Show Less" functionality.
  4. Repetitive code in form reset and error handling.
  5. Inconsistent naming conventions (mixing camelCase and lowercase).
  6. Suboptimal scoping of functions and variables.
  7. Use of older JavaScript syntax where more modern alternatives exist.

Addressing these issues will improve code efficiency, readability, and maintainability. Proposed changes include consolidating event listeners, optimizing DOM interactions, reducing code duplication through function refactoring, and adopting more consistent naming and modern JavaScript practices. These improvements will not alter the existing functionality but will make the codebase more robust and easier to work with in the future.

Please add labels #hacktoberfest-accepted, #hacktoberfest, #level3 (I'm a hacktoberfest contributor)

Record

github-actions[bot] commented 1 day ago

Thanks for creating the issue in SwapReads! Before you start working on your PR, please make sure to:

github-actions[bot] commented 1 day ago

Thank you for creating this issue! πŸŽ‰ Your issue will soon be reviewed by either the PA or a mentor. Please note that Level 1 is temporary and can be changed during the review. In the meantime, please make sure to provide all the necessary details and context. If you have any questions or additional information, feel free to add them here. Your contributions are highly appreciated! 😊

You can also check our CONTRIBUTING.md for guidelines on contributing to this project.

Aayush2308 commented 1 day ago

Thank you for assigning me, I have opened a PR also