Reorganized code to run only when the DOM is fully loaded. #90
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The main objective of this commit is to avoid problems when executing the code, when the DOM takes much longer to load than the javascript itself. Because when the DOM takes too long to load and the javascript is executed, the highlight and share modal/tooltip does not work, since when using document.querySelector("#has-highlight-and-share") it is not present in the document yet.
This commit further organizes the js code to improve readability and maintainability. Key changes include encapsulating the functionality in separate functions and adding additional comments for clarity. This makes the code easier to navigate and understand, improving maintainability and facilitating possible future changes.
Type of PR
Where is the Bug? (please remove if not relevant)
How Has This Been Tested (please remove if not relevant)?
Select any that are applicable
Checklist
Please select all that are applicable.
development
as the base branch.