-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
Make zim's articles insert itself client specific js. #392
Comments
I believe in using and external JS to introduce the taskbar (so most of the code is in a an external JS resource/URI, but the triggering of the event is still hardcoded in the DOM via C++ in kiwix-serve) but I don't believe that creating a reverse-JS-API is a good idea. This is elegant but put a constraint on the the ZIM creators which is not worth it. ZIM readers anyway read/write the DOM, this will be in particular true when the ZIM JS API will be there, so this does not really matter. In term of use case, we have only one case AFAIK, which is kiwix-serve (where we don't have really a control of the DOM outside the C++). |
Comment from @tim-moody on previous issue :
|
Comment from @rgaudin on previous issue :
|
The only constraints would be to insert
I don't know about android and ios/macos, but kiwix-desktop don't. From what I know, only kiwix-serve does it (to introduce the taskbar and the external links blocker).
That's true. |
Yes. But this is more complex than this, because depending where you put that
They all do it except Kiwix-Desktop indeed, and this is missing, see for example kiwix/kiwix-desktop#42 or
AFAIK, I'm not aware about any ticket which would be solved by this, therefore I still believe we can agree that this is still better to have one |
We could also introduce a metadata at ZIM level indicating to not touch the DOM and in this case it's the content that's responsible to inject that commonly-named JS file or not. |
It would be necessary anyway to allow the client to know if it must add the taskbar (old zim) or not. |
Not really, it would be js injected, it would be to the js to adapt the DOM. There is no real impact on where the the script is inserted (and if it is important, I prefer to have the wrapper inserting it where it make sense instead of the reading try to insert it at the right place). The real point is about the relative url of the script. We could enforce that the url is relative (a must have) but point to the root of the zim file (and so wrapper has to be a bit smart).
This is the ticket.
There is no need to modify the content. For TOC we could simply read the content, not modify it (without speaking of the js api discussed in openzim/mwoffliner#1237). For darkmode, we need a custom CSS, and the qtwebengine exeample does it without modify the content, it inject a js to add the css : https://doc.qt.io/qt-5/qtwebengine-webenginewidgets-stylesheetbrowser-example.html
#391 ? |
We are pretty far down the road of assuming js in the browser. Our whole menuing system is done in js on the client. Even on OLPC XOs there is js, though not the most recent. Maybe @holta can add more. |
I believe I share this opinion. |
@kelson42 not sure why you closed this. Is it rejected as an enhancement? |
I think that @tim-moody said we can almost assume we have js in the browser. Their whole menuing system is done in js on the client side. |
#322 as well but I'm not looking much at bugs it could fix rather than what it enables:
|
at what point would the added js script gain control? |
This comment has been minimized.
This comment has been minimized.
As any js script : Gain full control on the DOM and can change whatever it want. (Limited by crossdomain access authorization) |
This comment has been minimized.
This comment has been minimized.
This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions. |
(I'm not sure where to create this issue, I keep it in the same repository of the original comment)
We could use a small js file in every article to modify the dom. This small (or not) script would always be the same name, a wellknown name (ie,
/clientScript.js
or something like that). Even if all articles in the zim file would try to include it, it would be not in the zim file, but provided by the client (kiwix-tools, android, macos, desktop client, ...). It would be to the js to modify the dom to add the taskbar, do ask for suggestions and so.I see several pros for this:
The main cons I see is that we need js compatible browser. This is the case for most of the browser in the market but some vendors may use
pretty old browser or specific device that doesn't support js (I'm thinking about reader/tablet). We should see with them if this is a blocker or not (@tim-moody, @letompouce, other...)
Originally posted by @mgautierfr in #322 (comment)
The text was updated successfully, but these errors were encountered: