Animate hint activation

This commit is contained in:
Kovid Goyal 2020-12-15 21:17:02 +05:30
parent 96ba30f754
commit 7f202f513d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 18 additions and 1 deletions

View File

@ -933,7 +933,11 @@ class IframeBoss:
hint = data.hint hint = data.hint
if hint.type is 'link': if hint.type is 'link':
a = document.body.querySelector(f'[data-calibre-hint-value="{hint.value}"]') a = document.body.querySelector(f'[data-calibre-hint-value="{hint.value}"]')
a.addEventListener("animationend", def (ev):
a.classList.remove('calibre-animated-hint')
self.activate_link(hint.data.name, hint.data.frag, a) self.activate_link(hint.data.name, hint.data.frag, a)
, False)
a.classList.add('calibre-animated-hint')
def main(): def main():

View File

@ -125,6 +125,19 @@ def apply_colors(is_content_popup):
cursor: default !important;\ cursor: default !important;\
padding: 1px !important;\ padding: 1px !important;\
border: solid 1px {opts.color_scheme.foreground} !important;\ border: solid 1px {opts.color_scheme.foreground} !important;\
}}
.calibre-animated-hint {{
animation-name: calibre-animate-hint; \
animation-duration: 0.3s; \
animation-timing-function: ease-out; \
display: inline-block !important; \
text-indent: 0 !important; \
}}
@keyframes calibre-animate-hint {{
from {{ transform: scale(1); }}
to {{ transform: scale(2); }}
}} }}
''' '''
ss.textContent = text ss.textContent = text