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

Optimize main.js #20093

Merged
merged 4 commits into from
May 6, 2024
Merged

Optimize main.js #20093

merged 4 commits into from
May 6, 2024

Conversation

RedYetiDev
Copy link
Contributor

This Pull Request optimizes the functions used in /docs/_spec/public/scripts/main.js.

Changes made:

  1. currentChapter() function was simplified using split() and pop() instead of lastIndexOf() and substring().
  2. Used template literals for string interpolation.
  3. Simplified the heading function by reducing repetitive code and improving readability.
  4. Changed .removeClass() and .addClass() to .toggleClass() for toggling the class based on condition.
  5. General cleanup and optimization for better readability and performance.

@SethTisue
Copy link
Member

why remove comments?

@Gedochao Gedochao requested a review from jchyb April 5, 2024 06:59
@RedYetiDev
Copy link
Contributor Author

RedYetiDev commented Apr 5, 2024

why remove comments?

My code minifier automatically removes them, I can add them back if you'd like?

Edit: change prettier to minifier

@SethTisue
Copy link
Member

My code minifier automatically removes them, I can add them back if you'd like?

Yes please — the comments have value.

@RedYetiDev
Copy link
Contributor Author

RedYetiDev commented Apr 6, 2024

Sure, I'll add them back later today or tomorrow. I've also fixed my minifier settings, sorry.

@RedYetiDev
Copy link
Contributor Author

RedYetiDev commented Apr 7, 2024

Comments have been added,

@SethTisue, would you like me to squash?

Copy link
Contributor

@jchyb jchyb left a comment

Choose a reason for hiding this comment

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

Sorry for the long wait. The changes look good, I just have a few nitpicks.

docs/_spec/public/scripts/main.js Outdated Show resolved Hide resolved
docs/_spec/public/scripts/main.js Outdated Show resolved Hide resolved
@RedYetiDev RedYetiDev requested a review from jchyb April 16, 2024 11:21
@RedYetiDev
Copy link
Contributor Author

Sorry for the long wait. The changes look good, I just have a few nitpicks.

No problem! Take your time!

Copy link
Contributor

@jchyb jchyb left a comment

Choose a reason for hiding this comment

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

LGTM!

@jchyb jchyb merged commit 6d29951 into scala:main May 6, 2024
19 checks passed
@RedYetiDev RedYetiDev deleted the patch-1 branch May 6, 2024 12:21
WojciechMazur pushed a commit to WojciechMazur/dotty that referenced this pull request May 6, 2024
This Pull Request optimizes the functions used in
`/docs/_spec/public/scripts/main.js`.

## Changes made:

1. `currentChapter()` function was simplified using `split()` and
`pop()` instead of `lastIndexOf()` and `substring()`.
2. Used template literals for string interpolation.
3. Simplified the `heading` function by reducing repetitive code and
improving readability.
4. Changed `.removeClass()` and `.addClass()` to `.toggleClass()` for
toggling the class based on condition.
5. General cleanup and optimization for better readability and
performance.
@Kordyjan Kordyjan added this to the 3.5.0 milestone May 10, 2024
WojciechMazur pushed a commit that referenced this pull request Jul 6, 2024
This Pull Request optimizes the functions used in
`/docs/_spec/public/scripts/main.js`.

## Changes made:

1. `currentChapter()` function was simplified using `split()` and
`pop()` instead of `lastIndexOf()` and `substring()`.
2. Used template literals for string interpolation.
3. Simplified the `heading` function by reducing repetitive code and
improving readability.
4. Changed `.removeClass()` and `.addClass()` to `.toggleClass()` for
toggling the class based on condition.
5. General cleanup and optimization for better readability and
performance.
[Cherry-picked 6d29951]
WojciechMazur added a commit that referenced this pull request Jul 6, 2024
Backports #20093 to the LTS branch.

PR submitted by the release tooling.
[skip ci]
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.

4 participants