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

remove inline.js from head.html and footer.html #9177

Merged
merged 3 commits into from
May 23, 2024
Merged

Conversation

RayBB
Copy link
Collaborator

@RayBB RayBB commented Apr 29, 2024

Closes #9176
This gets ride of inline js from head.html and footer.html.
After this, the only place left is in Swagger but we're still figuring out what to do with that.

Technical

Nothing fancy, just moving the code to the corresponding places.

Testing

I've looked through the code and as far as I can tell, window.q is totally gone, so we can remove these last bits of inline JS in the header and footers. I tested this in part by adding an alert() if there was anything added to inline js and browsed the site locally without ever finding such an instance.

Screenshot

Stakeholders

@jimchamp since you've reviewed a few other of these.

Copy link
Collaborator

@cdrini cdrini left a comment

Choose a reason for hiding this comment

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

Lgtm! One comment. Can you test that our analytics events are working after the change on testing? You should see e.g. a 0.gif request in the networks panel.

I'm not sure how we can test service worker is still working; maybe try unregistering the service worker on chrome and load the page again to confirm it re-registers.

openlibrary/plugins/openlibrary/js/index.js Outdated Show resolved Hide resolved
@cdrini cdrini added the Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] label May 22, 2024
@github-actions github-actions bot removed the Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] label May 22, 2024
@RayBB
Copy link
Collaborator Author

RayBB commented May 22, 2024

@cdrini I'm having trouble deploying this to testing, seems like merge conflicts. When you get a chance could you try putting it there for me (probably removing some other commits from testing) so I can check the service worker stuff?

@RayBB RayBB added Needs: Staff / Internal Reviewed a PR but don't have merge powers? Use this. On testing.openlibrary.org This PR has been deployed to testing.openlibrary.org for testing labels May 22, 2024
@RayBB
Copy link
Collaborator Author

RayBB commented May 22, 2024

@cdrini deployed to testing

  • See the 0.gif post request working as expected
  • See the service worker registered just now (I opened in private chrome window) - so also working

Copy link
Collaborator

@cdrini cdrini left a comment

Choose a reason for hiding this comment

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

Awesome, thank you for testing! Looks good to me 👍

@cdrini cdrini merged commit 0c86113 into master May 23, 2024
5 checks passed
@cdrini cdrini deleted the refactor/head-inline-js branch May 23, 2024 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Staff / Internal Reviewed a PR but don't have merge powers? Use this. On testing.openlibrary.org This PR has been deployed to testing.openlibrary.org for testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

remove inline js from openlibrary/templates/site/head.html
2 participants