Skip to content

'$ is not defined' in readthedocs-doc-embed.js #9414

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

Closed
rfay opened this issue Jul 7, 2022 · 13 comments
Closed

'$ is not defined' in readthedocs-doc-embed.js #9414

rfay opened this issue Jul 7, 2022 · 13 comments
Labels
Bug A bug

Comments

@rfay
Copy link

rfay commented Jul 7, 2022

Details

Expected Result

Normal processing without js errors. (When I run mkdocs serve and view the same site I do not have js errors in console.)

Actual Result

In console:

Uncaught ReferenceError: $ is not defined
    at Object.get (readthedocs-doc-embed.js:1:22772)
    at Object.init (readthedocs-doc-embed.js:1:20826)
    at HTMLDocument.e (readthedocs-doc-embed.js:1:34016)

Is there some need to inject jquery or something for RTD? I don't remember seeing this before.

@stsewd
Copy link
Member

stsewd commented Jul 7, 2022

Hi, I think the material theme doesn't include jquery, so you need to add it https://www.mkdocs.org/user-guide/configuration/#extra_javascript.

We are planning to inject jquery conditionally #9359.

rfay added a commit to rfay/ddev that referenced this issue Jul 7, 2022
@rfay
Copy link
Author

rfay commented Jul 7, 2022

Thank you very much @stsewd - that solved that problem. Now if you'd just remind me how to get rid of the ethicalads.min.js crash "Error: No ad placements found". (I already unchecked the ads checkbox.)

ethicalads.min.js:1 Uncaught (in promise) Error: No ad placements found.
    at b (ethicalads.min.js:1:12013)
    at ethicalads.min.js:1:13123

@stsewd
Copy link
Member

stsewd commented Jul 7, 2022

@rfay where are you getting that error? Looks like you are testing the changes in a forked project, so not sure where to find it.

Also, you can enable builds from PRs https://docs.readthedocs.io/en/stable/pull-requests.html for your project, so you don't need to use a fork to test things.

@rfay
Copy link
Author

rfay commented Jul 7, 2022

@stsewd
Copy link
Member

stsewd commented Jul 7, 2022

@davidfischer may have more information about that error.

@davidfischer
Copy link
Contributor

This definitely looks like a jquery should be there but isn't error.

@rfay
Copy link
Author

rfay commented Jul 7, 2022

@davidfischer thanks for looking at this. I added jquery, got past the original issue. Now javascript errors out with the "ethicalads.min.js:1 Uncaught (in promise) Error: No ad placements found" as described in #9414 (comment)

I assume that's an RTD problem right? I remember seeing it before long ago, don't remember a solution.

@davidfischer
Copy link
Contributor

Got it. I was confused.

I assume that's an RTD problem right? I remember seeing it before long ago, don't remember a solution.

Ahh. As you may know, RTD is funded with advertising and our ad client throws this error (probably should just be a warning) if there's nowhere to put an ad on the page. Are you seeing this on a public URL (eg. something.readthedocs.io) or locally? I saw you were using make serve (a local docs build on your machine, I presume?) but our ad client shouldn't be injected for a local build.

@rfay
Copy link
Author

rfay commented Jul 7, 2022

Thanks @davidfischer - It's a public RTD URL and details are in #9414 (comment) - you can easily see it yourself.

See the browser js console (chrome) on https://test-ddev.readthedocs.io/en/latest/, which is being built from https://github.com/rfay/ddev/tree/20220707_docs2,, build is https://readthedocs.org/projects/test-ddev/builds/17382495/

@davidfischer
Copy link
Contributor

Got it. This shouldn't be logged as an error. I should be able to release a fix in a day or two.

@rfay
Copy link
Author

rfay commented Jul 7, 2022

Awesome, thanks @davidfischer

@stsewd stsewd added the Bug A bug label Aug 18, 2022
@humitos
Copy link
Member

humitos commented Jan 31, 2023

@stsewd this problem is solved since our js file auto-loads jQuery now, right? This work was done in #9861

@stsewd
Copy link
Member

stsewd commented Jan 31, 2023

yeah, the original issue reported here should be fixed. For the other issue please subscribe to readthedocs/ethical-ad-client#130.

@stsewd stsewd closed this as completed Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug
Projects
None yet
Development

No branches or pull requests

4 participants