mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
E-book viewer: Add support for HTML image maps. Fixes #2040487 [Image hotspots using map tag results in error message](https://bugs.launchpad.net/calibre/+bug/2040487)
This commit is contained in:
parent
2feaa3e854
commit
9763120b3d
@ -432,7 +432,7 @@ def transform_inline_styles(container, name, transform_sheet, transform_style):
|
|||||||
|
|
||||||
|
|
||||||
def transform_html(container, name, virtualize_resources, link_uid, link_to_map, virtualized_names):
|
def transform_html(container, name, virtualize_resources, link_uid, link_to_map, virtualized_names):
|
||||||
link_xpath = XPath('//h:a[@href]')
|
link_xpath = XPath('//h:*[@href and (self::h:a or self::h:area)]')
|
||||||
svg_link_xpath = XPath('//svg:a')
|
svg_link_xpath = XPath('//svg:a')
|
||||||
img_xpath = XPath('//h:img[@src]')
|
img_xpath = XPath('//h:img[@src]')
|
||||||
svg_img_xpath = XPath('//svg:image[@xl:href]')
|
svg_img_xpath = XPath('//svg:image[@xl:href]')
|
||||||
@ -604,7 +604,7 @@ def worker_main():
|
|||||||
def virtualize_html(container, name, link_uid, link_to_map, virtualized_names):
|
def virtualize_html(container, name, link_uid, link_to_map, virtualized_names):
|
||||||
|
|
||||||
changed = set()
|
changed = set()
|
||||||
link_xpath = XPath('//h:a[@href]')
|
link_xpath = XPath('//h:*[@href and (self::h:a or self::h:area)]')
|
||||||
svg_link_xpath = XPath('//svg:a')
|
svg_link_xpath = XPath('//svg:a')
|
||||||
link_replacer = create_link_replacer(container, link_uid, changed)
|
link_replacer = create_link_replacer(container, link_uid, changed)
|
||||||
|
|
||||||
|
@ -691,7 +691,7 @@ class IframeBoss:
|
|||||||
self.comm.send_message(action, data)
|
self.comm.send_message(action, data)
|
||||||
|
|
||||||
def connect_links(self):
|
def connect_links(self):
|
||||||
for a in document.body.querySelectorAll(f'a[{self.link_attr}]'):
|
for a in document.body.querySelectorAll(f'a[{self.link_attr}],area[{self.link_attr}]'):
|
||||||
a.addEventListener('click', self.link_activated)
|
a.addEventListener('click', self.link_activated)
|
||||||
if runtime.is_standalone_viewer:
|
if runtime.is_standalone_viewer:
|
||||||
# links with a target get turned into requests to open a new window by Qt
|
# links with a target get turned into requests to open a new window by Qt
|
||||||
|
Loading…
x
Reference in New Issue
Block a user