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

PhET zim not read on Kiwix-JS #339

Closed
Popolechien opened this issue Jan 31, 2018 · 11 comments
Closed

PhET zim not read on Kiwix-JS #339

Popolechien opened this issue Jan 31, 2018 · 11 comments
Labels
Milestone

Comments

@Popolechien
Copy link
Member

I basically get the splash screen and that's it - no way to access content (either Kiwix JS windows or browser extension). See image:
phet

@mossroy
Copy link
Contributor

mossroy commented Jan 31, 2018

This is a known issue. Kiwix-js does not currently inject the javascript files at all.
It was causing issues in the browser engine (but it was a long time ago, so maybe this could be tested again).
See #152 .
Anyway, I don't know if enabling javascript would be enough to make PhET files work. There might be other contents that are not well supported by kiwix-js.

@mossroy mossroy added this to the v2.3 milestone Jan 31, 2018
@Popolechien
Copy link
Member Author

Ok thanks - I'd seen #152 but wasn't entirely sure it was the same problem.

@mossroy
Copy link
Contributor

mossroy commented Jan 31, 2018

To be honest, I'm not 100% sure either. But I don't see how these PhET experiments would work without a bunch of javascript code, so I did not investigate more.

@mossroy
Copy link
Contributor

mossroy commented Nov 14, 2018

Javascript is now enabled in ServiceWorker mode. PhET seems to work properly in this mode.

@kelson42
Copy link
Collaborator

@mossroy I have tried with last nightly and https://download.kiwix.org/zim/phet/phet_fr_2018-11.zim. The welcome page is empty = not displayed properly to me. I'm in Jquery mode as service worker does not work out-of-the-box on FF.

@Jaifroid
Copy link
Member

Jaifroid commented Nov 18, 2018

@kelson42 In master, only SW mode currently supports PhET. I have an experimental branch, JavaScript Support that include JS support in jQuery mode. However, the front page of PhET is not currently working in that branch in jQuery mode. If you press the random button in that branch, you'll see that a random experiment will load and is usable. But I need to debug the landing page. It's probably because it uses ReactJS (I think), and that involves a lot of inline JavaScript, which my branch tries to put into attached scripts so that a page will work with a restrictive CSP. I may have to ditch that workaround.

@mossroy
Copy link
Contributor

mossroy commented Nov 18, 2018

@kelson42 : try on Chromium/Chrome with a recent nightly of kiwix-js Chrome extension, and choose the ServiceWorker mode. Firefox still blocks ServiceWorkers in extensions, even if they plan to enable it in the future.
Or try on any recent browser with a local copy of the code (master branch), accessed through a local web server (even if we know it's not suitable for end-users), and choose ServiceWorker mode.
Or try on any browser with the branch @Jaifroid is working on (see his comment above), in jQuery mode

@Jaifroid
Copy link
Member

:-)

image

@mossroy
Copy link
Contributor

mossroy commented Nov 18, 2018

In ServiceWorker mode, the latest gutenberg seems to work well too, and also various ZIMs that have videos (tedx, oer4schools, dirtybiology etc, even if moving to a specific time in the video does not work on all browsers)

@Jaifroid
Copy link
Member

Jaifroid commented Nov 20, 2018

I can get the PhET UI to show up in jQuery mode in my JS support branch if: a) I disable the code that searches for <script>…</script> blocks, and replaces them with blob scripts; and b) I run Kiwix JS from localhost (but still in jQuery mode). The problem is that some script blocks are in fact React JSX templates, and these clearly need to be left in place. I can exclude script blocks of type text/html form the replacement.

However, it is still not possible (yet) to launch titles from this UI because we would need to patch the JavaScript that references the ZIM url, so that it launches the extraction engine. This looks pretty difficult to do. However, if we can get our standard search to work correctly in these ZIMs (#440), it would mitigate this problem.

@Jaifroid
Copy link
Member

Jaifroid commented Mar 4, 2020

PhET is now supported in Service Worker mode, and a banner is thrown up in jQuery mode asking the user to switch (and showing how). I do have an experimental branch that injects JS in jQuery mode, and it can run PhET experiments, but it can't run the React-based UI. In any case, this issue is a specific case of #152 , and that issue would be the place to solve it if it's worthwhile merging my version that enables injection of JavaScript from the ZIM. So I'm closing this (though feel free to re-open if it needs further discussion here).

@Jaifroid Jaifroid closed this as completed Mar 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants