mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-12-26 06:47:25 -05:00
16 lines
618 B
Plaintext
16 lines
618 B
Plaintext
# vim:fileencoding=utf-8
|
|
# License: GPL v3 Copyright: 2019, Kovid Goyal <kovid at kovidgoyal.net>
|
|
from __python__ import bound_methods, hash_literals
|
|
|
|
|
|
|
|
def get_elements(x, y):
|
|
nonlocal img_id_counter
|
|
ans = {'link': None, 'img': None}
|
|
for elem in document.elementsFromPoint(x, y):
|
|
if elem.tagName.toLowerCase() is 'a' and elem.getAttribute('href') and not ans.link:
|
|
ans.link = elem.getAttribute('href')
|
|
elif elem.tagName.toLowerCase() is 'img' and elem.getAttribute('data-calibre-src') and not ans.img:
|
|
ans.img = elem.getAttribute('data-calibre-src')
|
|
return ans
|