|
@ -26,14 +26,14 @@ tag app-links |
|
|
s ||= state.query |
|
|
s ||= state.query |
|
|
await window.navigator.clipboard.writeText(s) |
|
|
await window.navigator.clipboard.writeText(s) |
|
|
state.query = '' |
|
|
state.query = '' |
|
|
sort_links! |
|
|
api.sort_links! |
|
|
|
|
|
|
|
|
def handle_add |
|
|
def handle_add |
|
|
state.loading = yes |
|
|
state.loading = yes |
|
|
try |
|
|
try |
|
|
await api.add_link state.query |
|
|
await api.add_link state.query |
|
|
state.query = '' |
|
|
state.query = '' |
|
|
sort_links! |
|
|
api.sort_links! |
|
|
catch e |
|
|
catch e |
|
|
err "adding link", e |
|
|
err "adding link", e |
|
|
state.loading = no |
|
|
state.loading = no |
|
@ -61,11 +61,6 @@ tag app-links |
|
|
else |
|
|
else |
|
|
api.navigate link |
|
|
api.navigate link |
|
|
|
|
|
|
|
|
def handle_del |
|
|
|
|
|
if state.query.length < 1 |
|
|
|
|
|
state.active_bang = no |
|
|
|
|
|
api.sort_links! |
|
|
|
|
|
|
|
|
|
|
|
def handle_click_delete link |
|
|
def handle_click_delete link |
|
|
return unless window.confirm "Do you really want to delete {link..display_name}?" |
|
|
return unless window.confirm "Do you really want to delete {link..display_name}?" |
|
|
handle_delete link |
|
|
handle_delete link |
|
@ -122,15 +117,6 @@ tag app-links |
|
|
|
|
|
|
|
|
<input$links-input |
|
|
<input$links-input |
|
|
bind=state.query |
|
|
bind=state.query |
|
|
@hotkey('return').capture.if(!state.loading)=handle_return |
|
|
|
|
|
@hotkey('tab').capture.if(!state.loading)=api.toggle_effective_names |
|
|
|
|
|
@hotkey('esc').capture.if(!state.loading)=toggle_settings |
|
|
|
|
|
@hotkey('shift+return').capture.if(!state.loading)=handle_shift_return |
|
|
|
|
|
@hotkey('esc').capture.if(!state.loading)=handle_esc |
|
|
|
|
|
@hotkey('shift+backspace').capture.if(!state.loading)=handle_shift_backspace |
|
|
|
|
|
@hotkey('down').capture.if(!state.loading)=api.increment_link_selection_index |
|
|
|
|
|
@hotkey('up').capture.if(!state.loading)=api.decrement_link_selection_index |
|
|
|
|
|
@keydown.del.if(!state.loading)=handle_del |
|
|
|
|
|
@input.if(!state.loading)=handle_input |
|
|
@input.if(!state.loading)=handle_input |
|
|
@paste.if(!state.loading)=handle_paste |
|
|
@paste.if(!state.loading)=handle_paste |
|
|
@cut=handle_cut |
|
|
@cut=handle_cut |
|
@ -149,7 +135,7 @@ tag app-links |
|
|
if config.data.enable_tips |
|
|
if config.data.enable_tips |
|
|
if state.active_bang |
|
|
if state.active_bang |
|
|
|
|
|
|
|
|
<.tips> |
|
|
<app-tips> |
|
|
|
|
|
|
|
|
<.tip |
|
|
<.tip |
|
|
@click=(state.active_bang = no) |
|
|
@click=(state.active_bang = no) |
|
@ -160,39 +146,91 @@ tag app-links |
|
|
|
|
|
|
|
|
else |
|
|
else |
|
|
|
|
|
|
|
|
<.tips> |
|
|
<app-tips> |
|
|
|
|
|
|
|
|
<.tip |
|
|
<.tip-row> |
|
|
@click=handle_click_link |
|
|
|
|
|
@hotkey('return').force.if(!loading)=handle_click_link |
|
|
<.tip |
|
|
> |
|
|
@click=handle_click_link |
|
|
<.tip-hotkey> "Return" |
|
|
@hotkey('return').force.if(!loading)=handle_click_link |
|
|
<.tip-content> "Navigate To Link" |
|
|
> |
|
|
|
|
|
<.tip-hotkey> "Return" |
|
|
<.tip[fl:2] @click=handle_shift_return> |
|
|
<.tip-content> "Navigate To Link" |
|
|
<.tip-hotkey> "Shift + Return" |
|
|
|
|
|
<.tip-content.ellipsis> |
|
|
<.tip |
|
|
<span[ws:pre]> "Add New Link " |
|
|
@click=handle_shift_return |
|
|
let sq = state.query.trim!.split /\s+/ |
|
|
@hotkey('shift+return').capture.if(!state.loading)=handle_shift_return |
|
|
if sq.length >= 2 |
|
|
> |
|
|
let url = sq.pop! |
|
|
<.tip-hotkey> "Shift + Return" |
|
|
<span> '"' |
|
|
<.tip-content.ellipsis> |
|
|
<span> sq.join " " |
|
|
<span[ws:pre]> "Create Link " |
|
|
<span[c:blue3 ws:pre]> " {url}" |
|
|
let sq = state.query.trim!.split /\s+/ |
|
|
<span> '"' |
|
|
if sq.length >= 2 |
|
|
|
|
|
let url = sq.pop! |
|
|
|
|
|
<span> '"' |
|
|
|
|
|
<span> sq.join " " |
|
|
|
|
|
<span[c:blue3 ws:pre]> " {url}" |
|
|
|
|
|
<span> '"' |
|
|
|
|
|
else |
|
|
|
|
|
<span> "\"{sq.join " "}\"" |
|
|
|
|
|
|
|
|
|
|
|
<.tip |
|
|
|
|
|
@click=handle_shift_backspace |
|
|
|
|
|
@hotkey('shift+backspace').capture.if(!state.loading)=handle_shift_backspace |
|
|
|
|
|
> |
|
|
|
|
|
<.tip-hotkey> "Shift + Backspace" |
|
|
|
|
|
<.tip-content> "Edit Link" |
|
|
|
|
|
|
|
|
|
|
|
<app-tips-more$tips-more> |
|
|
|
|
|
|
|
|
|
|
|
<.tip-row> |
|
|
|
|
|
|
|
|
|
|
|
<.tip |
|
|
|
|
|
@click.if(!state.loading)=api.toggle_effective_names |
|
|
|
|
|
@hotkey('tab').capture.if(!state.loading)=api.toggle_effective_names |
|
|
|
|
|
> |
|
|
|
|
|
<.tip-hotkey> "Tab" |
|
|
|
|
|
<.tip-content> "Toggle Effective Names" |
|
|
|
|
|
|
|
|
|
|
|
<.tip |
|
|
|
|
|
@click.if(!state.loading)=api.toggle_settings |
|
|
|
|
|
@hotkey('esc').capture.if(!state.loading)=toggle_settings |
|
|
|
|
|
> |
|
|
|
|
|
<.tip-hotkey> "Esc" |
|
|
|
|
|
<.tip-content> "Toggle Settings" |
|
|
|
|
|
|
|
|
|
|
|
<.tip.noclick |
|
|
|
|
|
@hotkey('down').capture.if(!state.loading)=api.increment_link_selection_index |
|
|
|
|
|
@hotkey('up').capture.if(!state.loading)=api.decrement_link_selection_index |
|
|
|
|
|
> |
|
|
|
|
|
<.tip-hotkey> "Up/Down Arrow" |
|
|
|
|
|
<.tip-content> "Move Selection" |
|
|
|
|
|
|
|
|
|
|
|
<.tip-row> |
|
|
|
|
|
|
|
|
|
|
|
<.tip |
|
|
|
|
|
@click.if(!loading)=handle_cut |
|
|
|
|
|
> |
|
|
|
|
|
if math_result |
|
|
|
|
|
<.tip-hotkey> "Cut (Math, If No Selection)" |
|
|
|
|
|
<.tip-content> "Cut Math Result" |
|
|
else |
|
|
else |
|
|
<span> "\"{sq.join " "}\"" |
|
|
<.tip-hotkey> "Cut (If No Selection)" |
|
|
|
|
|
<.tip-content> "Cut All Text" |
|
|
|
|
|
|
|
|
<.tip @click=handle_shift_backspace> |
|
|
<.tip.noclick> |
|
|
<.tip-hotkey> "Shift + Backspace" |
|
|
<.tip-hotkey> "Paste (If Input Empty)" |
|
|
<.tip-content> "Edit Link" |
|
|
<.tip-content> "Instant Search" |
|
|
|
|
|
|
|
|
<.links> |
|
|
<.tip.placeholder> |
|
|
css d:flex fld:column jc:flex-start |
|
|
|
|
|
fl:1 w:100% ofy:auto pt:15px |
|
|
|
|
|
|
|
|
|
|
|
if not viewing_community_links and (state.active_bang or state.sorted_links.length < 1) |
|
|
unless $tips-more.active |
|
|
<app-bang data=state.active_bang> |
|
|
<.links> |
|
|
else |
|
|
css d:flex fld:column jc:flex-start |
|
|
for link, index in state.sorted_links |
|
|
fl:1 w:100% ofy:auto |
|
|
<app-link link=link index=index> |
|
|
|
|
|
|
|
|
if not viewing_community_links and (state.active_bang or state.sorted_links.length < 1) |
|
|
|
|
|
<app-bang data=state.active_bang> |
|
|
|
|
|
else |
|
|
|
|
|
for link, index in state.sorted_links |
|
|
|
|
|
<app-link link=link index=index> |
|
|