Skip to content

Commit

Permalink
Remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Nov 24, 2024
1 parent c96a330 commit bb39475
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
6 changes: 1 addition & 5 deletions src/pyj/read_book/read_aloud.pyj
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ class ReadAloud:
def container(self):
return document.getElementById('book-read-aloud-overlay')

@property
def supports_css_min_max(self):
return True

@property
def bar(self):
return document.getElementById(self.bar_id)
Expand Down Expand Up @@ -109,7 +105,7 @@ class ReadAloud:
else:
bar_container.classList.remove('speaking')
clear(bar_container)
bar_container.style.maxWidth = 'min(40rem, 80vw)' if self.supports_css_min_max else '40rem'
bar_container.style.maxWidth = 'min(40rem, 80vw)'
bar_container.style.backgroundColor = get_color("window-background")
for x in [
E.div(style='height: 4ex; display: flex; align-items: center; padding: 5px; justify-content: center'),
Expand Down
17 changes: 5 additions & 12 deletions src/pyj/read_book/selection_bar.pyj
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ class SelectionBar:
notes = self.annotations_manager.notes_for_highlight(annot_id)
bar_container = self.bar
clear(bar_container)
bar_container.style.maxWidth = 'min(50rem, 90vw)' if self.supports_css_min_max else '50rem'
bar_container.style.maxWidth = 'min(50rem, 90vw)'
bar_container.style.backgroundColor = get_color("window-background")
notes_container = E.div()
notes_container.addEventListener('wheel', def(evt): evt.stopPropagation();, {'passive': False})
Expand Down Expand Up @@ -373,18 +373,11 @@ class SelectionBar:
c = notes_container.lastChild
notes_container.style.display = notes_container.previousSibling.style.display = 'block'
c.style.overflow = 'auto'
if self.supports_css_min_max:
c.style.maxHeight = 'min(20ex, 40vh)'
else:
c.style.maxHeight = '20ex'
c.style.maxHeight = 'min(20ex, 40vh)'
render_notes(notes, c, True)
# }}}

# accessors {{{
@property
def supports_css_min_max(self):
return not runtime.is_standalone_viewer or runtime.QT_VERSION >= 0x050f00

@property
def container(self):
return document.getElementById('book-selection-bar-overlay')
Expand Down Expand Up @@ -1159,11 +1152,11 @@ class SelectionBar:
if runtime.is_standalone_viewer:
url = get_current_link_prefix() + "?open_at=" + cfi
else:
url = get_current_link_prefix() + f"bookpos={cfi}"
url = get_current_link_prefix() + f"bookpos={cfi}"
for key, value in Object.entries(parse_url_params()):
if key != "bookpos":
url = url + f"&{key}={value}"
info = { "text" : data.highlighted_text,
info = { "text" : data.highlighted_text,
"url": url,
"timestamp": data.timestamp,
"style_type": data.style.type,
Expand All @@ -1187,7 +1180,7 @@ class SelectionBar:
"url": url,
}
copy_info = get_session_data().get('cite_text_template').format(**info)

ui_operations.copy_selection(copy_info)
else:
print('Ignoring annotations message with unknown type:', msg.type)
Expand Down

0 comments on commit bb39475

Please sign in to comment.