cschiller / zhongwen

Official source code of the "Zhongwen" Chrome extension
https://chrome.google.com/webstore/detail/zhongwen-chinese-english/kkmlkkjojmombglmlpbpapmhcaljjkde
GNU General Public License v2.0
312 stars 52 forks source link

Technical Documentation to help others debug why Zhongwen ext. is not working with some resources #85

Open nodje opened 2 years ago

nodje commented 2 years ago

Hi,

I'm only an occasional user of your ext, but I really need it, it does the job as it should, it's great. Only I find myself at a loss when it's not working. To start with, I just don't know what to enable to be able to see logs and potential error reports.

Right now I'm trying to understand why Zhongwen doesn't work when reading online book on Calibreweb (Slef hosting project of your calibre lib, see https://github.com/janeczku/calibre-web).

All I can see is proper html and chinese chars, I have really no clue as what could cause Zhongwen not to detect a chinese char.

cschiller commented 2 years ago

Hi @nodje, in case you downloaded some HTML files to your computer and want to use Zhongwen for reading these files, you might have to allow Zhongwen to access file URLs. This is not particular to Zhongwen, it's a restriction that Google imposes on all Chrome extensions. It's a security feature that prevents extensions from accessing files on your computer unless you specifically give them permission to do so.

Here's what you should try:

I hope this will fix your problem.

nodje commented 2 years ago

Hi Christian,

I've had the issue with local files and I'm glad to understand where it comes from. Hopefully there's a way to allow access to local files on Firefox as well.

But this time the books are shared on a proper webpage accessible from the web. I just don't know how where to start to understand what's not working exactly.

nodje commented 2 years ago

Hi Christian,

to follow up on the issue, maybe you can have a look at this resource: [redacted]

You'll notice that the book title and chapter on the top can be read from the dictionary extension, but not the content. The former is encapsulated in a classi chtml element (

), while the content of the book is in an iframe. I guess this would be the main reason.

But on a txt document l[redacted] the dictionary works as expected.

Maybe you'll have time to take a look, or maybe the simple fact that content is in an iframe is a showstopper.

ig3 commented 2 years ago

I am having the same issue with Calibre-Web. I have investigated a bit, with the conclusion that the plugin doesn't work with the contents of the iframe that Calibre-Web puts most of the content into.

I have a modification of the plugin that works on content in the iframe but the position of the pop-up isn't good.

I will provide a pull request when I have it working a bit better. I am reasonably confident I can make it work but I only started looking at this yesterday and I haven't worked with plugins or iframes before, so have a few unknowns to overcome. It may take a while yet. In the meantime, just wanted to let you know that I'm working on it and a solution seems possible.

mkarang commented 1 year ago

Hi @nodje, in case you downloaded some HTML files to your computer and want to use Zhongwen for reading these files, you might have to allow Zhongwen to access file URLs. This is not particular to Zhongwen, it's a restriction that Google imposes on all Chrome extensions. It's a security feature that prevents extensions from accessing files on your computer unless you specifically give them permission to do so.

Here's what you should try:

  • Type chrome://extensions/ in the address bar.
  • Look for Zhongwen and click on "Details".
  • Search for "Allow access to file URLs" and enable it.

I hope this will fix your problem.

Thanks! The above fixed it for me, but there's one more step to add: restart browser.

nodje commented 1 year ago

Hi @mkarang , thanks for your proposal. Unfortunately, it doesn't make a difference. Zhongwen still can't access the content :(

mkarang commented 1 year ago

Hi @mkarang , thanks for your proposal. Unfortunately, it doesn't make a difference. Zhongwen still can't access the content :(

I found out it depends on how I opened the file, One way to open it is open the file directly. On Chrome address bar, it shows like this: file:///path/something.html When I opened it this way, everything works well.

I can also open the above file so that the url is (just an example): https://drive.google.com/drive/u/1/my-drive . In this case, the file is being previewed using Google Drive. ZhongWen would still work, but only partially (mouse over works but not ALT + number).

calebmgshort commented 1 year ago

I am having the same issue with Calibre-Web. I have investigated a bit, with the conclusion that the plugin doesn't work with the contents of the iframe that Calibre-Web puts most of the content into.

I have a modification of the plugin that works on content in the iframe but the position of the pop-up isn't good.

I will provide a pull request when I have it working a bit better. I am reasonably confident I can make it work but I only started looking at this yesterday and I haven't worked with plugins or iframes before, so have a few unknowns to overcome. It may take a while yet. In the meantime, just wanted to let you know that I'm working on it and a solution seems possible.

@ig3 Real interested to hear if you ever came up with a solution for this. Every epub reader extensions seems to use iframe :(

ig3 commented 1 year ago

@calebmgshort The pull request to this issue is a crude solution. For a more complete solution you can have a look at @ig3/zhongwen which is available as a Firefox add-on. I don't use Chrome so haven't published it as a Chrome add-on but you might get it working from the source.