Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frontend Speedup #2183

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Frontend Speedup #2183

wants to merge 6 commits into from

Conversation

darkfated
Copy link
Contributor

Performance Boost for Frontend

  • HTML Optimizations: Moved JS script loading after HTML to improve page rendering.
  • Lazy Loading for Images: Implemented defer for images that load only under specific conditions.
  • jQuery Update: Updated jQuery to the latest version for better stability.
  • DOMContentLoaded Event: Changed the event for loading the menu to DOMContentLoaded, improving rendering speed and response time.
  • jQuery Refactoring: Reduced reliance on jQuery, replacing it with plain JavaScript to enhance performance and reduce overhead.

The jQuery update was tested, and no issues were detected. All existing functionality remains fully operational, and the overall performance has slightly improved with the new version.

@DarthTealc
Copy link
Contributor

This looks good, if it works in Awesomium.

There are a few places you could reduce jQuery reliance further while still working in Awesomium if you wanted. Some examples on loading.html replacing jQuery with vanilla javascript

  • Any first-match element selections eg $("#serverName") could use document.querySelector("#serverName")
  • Text value setting eg .text( servername ); could use .innerText = servername;
  • Attribute setting eg .attr("src", "asset://mapimage/" + mapname ); could use .setAttribute("src", "asset://mapimage/" + mapname);
  • CSS setting eg .css( "background-image", "url( 'asset://mapimage/" + mapname + "' )" ); could use .style.backgroundImage = "url( 'asset://mapimage/" + mapname + "' )";
  • Adding classes eg .addClass( "visible" ); could use .classList.add( "visible" );

@darkfated
Copy link
Contributor Author

This looks good, if it works in Awesomium.

There are a few places you could reduce jQuery reliance further while still working in Awesomium if you wanted. Some examples on loading.html replacing jQuery with vanilla javascript

  • Any first-match element selections eg $("#serverName") could use document.querySelector("#serverName")
  • Text value setting eg .text( servername ); could use .innerText = servername;
  • Attribute setting eg .attr("src", "asset://mapimage/" + mapname ); could use .setAttribute("src", "asset://mapimage/" + mapname);
  • CSS setting eg .css( "background-image", "url( 'asset://mapimage/" + mapname + "' )" ); could use .style.backgroundImage = "url( 'asset://mapimage/" + mapname + "' )";
  • Adding classes eg .addClass( "visible" ); could use .classList.add( "visible" );

Awesomium is working. Yes, your suggestions are good

Copy link
Contributor

@DarthTealc DarthTealc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked out these changes briefly in both x86-64 and Main and I didn't experience any regressions. Everything seems to work without issue. I'd endorse merging.

Only thing I wonder is if we even still need jquery-color.js and jquery-ui.js, and if so, could they be replaced with lightweight standard jquery use or vanilla javascript. But that's probably worth doing as a separate pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants