mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
E-book viewer: Fix clicking on links with empty destinations hanging the viewer. Fixes #2034404 [E-book viewer: error navigating calibre User Manual](https://bugs.launchpad.net/calibre/+bug/2034404)
This commit is contained in:
parent
e01740cf8a
commit
298c6fe3e0
@ -395,6 +395,8 @@ def transform_html(container, name, virtualize_resources, link_uid, link_to_map,
|
|||||||
href = a.get(attr)
|
href = a.get(attr)
|
||||||
if href:
|
if href:
|
||||||
href = link_replacer(name, href)
|
href = link_replacer(name, href)
|
||||||
|
else:
|
||||||
|
a.set(attr, 'javascript:void(0)')
|
||||||
if href and href.startswith(link_uid):
|
if href and href.startswith(link_uid):
|
||||||
a.set(attr, 'javascript:void(0)')
|
a.set(attr, 'javascript:void(0)')
|
||||||
parts = href.split('|')
|
parts = href.split('|')
|
||||||
@ -533,6 +535,8 @@ def virtualize_html(container, name, link_uid, link_to_map, virtualized_names):
|
|||||||
elif href:
|
elif href:
|
||||||
a.set('target', '_blank')
|
a.set('target', '_blank')
|
||||||
a.set('rel', 'noopener noreferrer')
|
a.set('rel', 'noopener noreferrer')
|
||||||
|
else:
|
||||||
|
a.set(attr, 'javascript:void(0)')
|
||||||
|
|
||||||
for a in link_xpath(root):
|
for a in link_xpath(root):
|
||||||
handle_link(a)
|
handle_link(a)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user