FooSoft / yomichan

Japanese pop-up dictionary extension for Chrome and Firefox.
https://foosoft.net/projects/yomichan
Other
1.06k stars 215 forks source link

[feature request] iframe support #29

Closed jpc-ae closed 4 years ago

jpc-ae commented 7 years ago

There are several sites, like google translator toolkit, where different parts of the page are broken up into iframes. It would be nice to be able to check text in all the frames on sites that still use them.

FooSoft commented 7 years ago

Could you link me to specific page(s) that does not work?

jpc-ae commented 7 years ago

Well, it might be a niche use-case, but if you go to https://translate.google.com/toolkit/ and upload some Japanese text to work on, then open it, the left pane in the workbench (the opened file) isn't being parsed

siikamiika commented 7 years ago

Twitter widget: http://dic.nicovideo.jp/

FooSoft commented 7 years ago

So this is still appears to be a problem for the twitter widget, but the latest release solves IFRAME issues in general. I think the problem is that the Twitter IFRAME is procedurally generated so that the content script is not injected into it? Need to investigate this further.

seanblue commented 4 years ago

I'm still seeing some iframe issues. Take this Amazon page. Scanning the text in the description (starting with 1000年後の日本。) don't show the popup.

I've seen the popup not work on other sites, but I'm not sure if they were iframe issues and I don't remember the sites off hand.

siikamiika commented 4 years ago

@seanblue For me the popup shows up, but it's almost unusable because the iframe is so small. It would be possible to open a popup on the root page with the framework that was added in recursive popups (https://github.com/FooSoft/yomichan/pull/185), but there could be some problems positioning the popup according to https://github.com/FooSoft/yomichan/pull/185#issuecomment-522788721.

toasted-nutbread commented 4 years ago

I have looked into supporting iframes after the recursive popups were added, and the only issue that really prevents it is that there is no way to determine which <iframe> corresponds to which frameId. This makes it very difficult to determine what the correct offset for the popup should be on the root page. I suppose it would be possible to use "Full width" display mode to avoid this issue, but I think it's worth trying to exhaust any other potential methods of determining popup position before it comes to this.

JiaChen-Zeng commented 4 years ago

I seem to have the same problem. I am using a user script to make novel websites texts appear vertical, but with it when scanning text yomichan doesn't pop up. Inspecting it, I think it is because the texts are displayed in an iframe laid over the original content.

image

toasted-nutbread commented 4 years ago

Looking a bit more into this: the issue I mentioned in my previous comment in this thread is still present, but it may be worth it to support the "Full width" display mode as a first step.

However, another issue has presented itself: iframes don't load in a specific order, and they can also load before the root frame has completed loading. The result of this is that the proxy communication port that is (attempted to be) opened will occasionally fail because the root frame loads after the iframe. This is another issue which will need to be resolved before any sort of iframes support can work.

toasted-nutbread commented 4 years ago

FYI @M-Azuma: A change has been made to the development branch which makes the user script you mentioned in https://github.com/FooSoft/yomichan/issues/29#issuecomment-568198111 work with Yomichan: cc989f44113e7961ae0ebdd8b780a636a646f5c3. This change should be included in a future release.

siikamiika commented 4 years ago

@seanblue with https://github.com/FooSoft/yomichan/pull/417 merged, it will soon be possible to show popups created with iframe content on the root frame so that the popup size is not limited by the iframe size. It's found at "Show iframe popups in root frame" under General Options when advanced options are enabled.

This option won't work when the iframe is in fullscreen mode, and there's https://github.com/FooSoft/yomichan/issues/432 to track a workaround for it.

Another issue with the popup not showing up at all was already fixed earlier in https://github.com/FooSoft/yomichan/commit/cc989f44113e7961ae0ebdd8b780a636a646f5c3.