|
@ -1,35 +1,17 @@ |
|
|
tag app-bang |
|
|
tag app-bang |
|
|
|
|
|
|
|
|
def unset_active_bang |
|
|
get tips |
|
|
state.active_bang = no |
|
|
let tips = [] |
|
|
api.sort_links! |
|
|
|
|
|
|
|
|
|
|
|
get bang |
|
|
|
|
|
state.active_bang or config.data.default_bang |
|
|
|
|
|
|
|
|
|
|
|
get encoded_bang_query |
|
|
|
|
|
"{bang.url}{window.encodeURIComponent(state.query)}" |
|
|
|
|
|
|
|
|
|
|
|
def handle_bang |
|
|
|
|
|
await api.increment_link_frequency bang |
|
|
|
|
|
window.location.href = encoded_bang_query |
|
|
|
|
|
|
|
|
|
|
|
def render |
|
|
|
|
|
|
|
|
|
|
|
<self> |
|
|
|
|
|
css w:100% d:flex fld:column gap:15px |
|
|
|
|
|
|
|
|
|
|
|
<app-tips> |
|
|
|
|
|
|
|
|
|
|
|
<.tip-row> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tips.push <> |
|
|
<.tip |
|
|
<.tip |
|
|
@click=handle_bang |
|
|
@click=api.handle_bang |
|
|
@hotkey('return').capture.if(!state.loading)=handle_bang |
|
|
@hotkey('return').capture.if(!state.loading)=api.handle_bang |
|
|
> |
|
|
> |
|
|
<.tip-hotkey> "Return" |
|
|
<.tip-hotkey> "Return" |
|
|
<.tip-content> "Search" |
|
|
<.tip-content> "Search" |
|
|
|
|
|
|
|
|
|
|
|
tips.push <> |
|
|
<.tip |
|
|
<.tip |
|
|
@click=api.handle_add_link |
|
|
@click=api.handle_add_link |
|
|
@hotkey('shift+return').capture.if(!state.loading)=api.handle_add_link |
|
|
@hotkey('shift+return').capture.if(!state.loading)=api.handle_add_link |
|
@ -47,9 +29,10 @@ tag app-bang |
|
|
else |
|
|
else |
|
|
<span> "\"{sq.join " "}\"" |
|
|
<span> "\"{sq.join " "}\"" |
|
|
|
|
|
|
|
|
|
|
|
tips.push <> |
|
|
if state.active_bang |
|
|
if state.active_bang |
|
|
<.tip |
|
|
<.tip |
|
|
@click=unset_active_bang |
|
|
@click=api.unset_active_bang |
|
|
@hotkey('esc').capture.if(!state.loading)=unset_active_bang |
|
|
@hotkey('esc').capture.if(!state.loading)=unset_active_bang |
|
|
> |
|
|
> |
|
|
<.tip-hotkey> "Esc" |
|
|
<.tip-hotkey> "Esc" |
|
@ -59,10 +42,7 @@ tag app-bang |
|
|
<.tip-hotkey> "Paste (If Input Empty)" |
|
|
<.tip-hotkey> "Paste (If Input Empty)" |
|
|
<.tip-content> "Instant Search" |
|
|
<.tip-content> "Instant Search" |
|
|
|
|
|
|
|
|
<app-tips-more$tips-more> |
|
|
tips.push <> |
|
|
|
|
|
|
|
|
<.tip-row> |
|
|
|
|
|
|
|
|
|
|
|
<.tip |
|
|
<.tip |
|
|
@click.if(!state.loading)=api.toggle_effective_names |
|
|
@click.if(!state.loading)=api.toggle_effective_names |
|
|
@hotkey('tab').capture.if(!state.loading)=api.toggle_effective_names |
|
|
@hotkey('tab').capture.if(!state.loading)=api.toggle_effective_names |
|
@ -70,10 +50,9 @@ tag app-bang |
|
|
<.tip-hotkey> "Tab" |
|
|
<.tip-hotkey> "Tab" |
|
|
<.tip-content> "Toggle Effective Names" |
|
|
<.tip-content> "Toggle Effective Names" |
|
|
|
|
|
|
|
|
<.tip |
|
|
tips.push <> |
|
|
@click.if(!loading)=api.handle_cut |
|
|
<.tip @click.if(!loading)=api.handle_cut> |
|
|
> |
|
|
if api.math_result |
|
|
if math_result |
|
|
|
|
|
<.tip-hotkey> "Cut (Math, If No Selection)" |
|
|
<.tip-hotkey> "Cut (Math, If No Selection)" |
|
|
<.tip-content> "Cut Math Result" |
|
|
<.tip-content> "Cut Math Result" |
|
|
else |
|
|
else |
|
@ -81,28 +60,36 @@ tag app-bang |
|
|
<.tip-content> "Cut All Text" |
|
|
<.tip-content> "Cut All Text" |
|
|
|
|
|
|
|
|
if state.active_bang |
|
|
if state.active_bang |
|
|
|
|
|
tips.push <> |
|
|
<.tip.noclick> |
|
|
<.tip.noclick> |
|
|
<.tip-hotkey> "Paste (If Input Empty)" |
|
|
<.tip-hotkey> "Paste (If Input Empty)" |
|
|
<.tip-content> "Instant Search" |
|
|
<.tip-content> "Instant Search" |
|
|
else |
|
|
|
|
|
<.tip.placeholder> |
|
|
|
|
|
|
|
|
|
|
|
unless $tips-more.active |
|
|
tips |
|
|
<.bang.selected@click=handle_bang> |
|
|
|
|
|
|
|
|
def render |
|
|
|
|
|
|
|
|
|
|
|
<self> |
|
|
|
|
|
css w:100% d:flex fld:column gap:15px |
|
|
|
|
|
|
|
|
|
|
|
<app-tips$tips tips=tips> |
|
|
|
|
|
|
|
|
|
|
|
unless $tips.show_more |
|
|
|
|
|
<.bang.selected@click=api.handle_bang> |
|
|
css d:flex fld:row jc:space-between ai:center |
|
|
css d:flex fld:row jc:space-between ai:center |
|
|
px:16px py:11px rd:5px cursor:pointer c:#FAD4AB |
|
|
px:16px py:11px rd:5px cursor:pointer c:#FAD4AB |
|
|
|
|
|
|
|
|
<.link-left> |
|
|
<.link-left> |
|
|
css d:flex fl:1 |
|
|
css d:flex fl:1 |
|
|
|
|
|
|
|
|
<img.link-icon src=bang.icon> |
|
|
<img.link-icon src=api.bang.icon> |
|
|
css w:20px h:20px mr:10px rd:3px |
|
|
css w:20px h:20px mr:10px rd:3px |
|
|
|
|
|
|
|
|
<.display-name> encoded_bang_query |
|
|
<.display-name> api.encoded_bang_query |
|
|
css fs:20px word-break:break-all |
|
|
css fs:20px word-break:break-all |
|
|
|
|
|
|
|
|
<.link-right> |
|
|
<.link-right> |
|
|
css d:flex fld:row jc:space-between ai:center |
|
|
css d:flex fld:row jc:space-between ai:center |
|
|
|
|
|
|
|
|
<.frequency> bang.frequency |
|
|
<.frequency> api.bang.frequency |
|
|
css fs:15px ml:7px |
|
|
css fs:15px ml:7px |
|
|