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

Handle content in iframes #90

Open ig3 opened 2 years ago

ig3 commented 2 years ago

This is only tested in Firefox 91.4.1esr 64bit, against my Calibre-Web website but in this case it supports lookup for content in the embedded iframe and handles the iframe being removed and recreated when the browser window size changes. I have only tested character lookup because I have only used character lookup. In particular, I haven't tried any of the keyboard shortcuts to ensure they work for content in an iframe.

Much of this is new to me and I don't have knowledge or expertise to suggest that this is a good solution but it does seem to be working for me. If you find any faults in the implementation, I would be pleased to hear about them. Otherwise, I hope this helps you towards an enhancement to address the limitation reported in issue #85, should you be so inclined. And thank you for a great add-on, in any case.

ig3 commented 2 years ago

This later change seems to fix highlighting selected text in the iframe and, I hope, avoids trying to modify the iframe if it is a different domain. Also, I made the mistake of committing a .vimrc, which I have now removed from the history, thus the force push.