Browse Source

implement search on paste setting, dark theme setting, effecting names setting

main
familyfriendlymikey 2 years ago
parent
commit
35b1e5035e
  1. 37
      app/client.imba
  2. 6
      app/config.imba

37
app/client.imba

@ -119,7 +119,10 @@ tag app
def sort_links def sort_links
if state.query.trim!.length > 0 if state.query.trim!.length > 0
state.scored_links = fzi state.links, state.query if config.enable_effective_names
state.scored_links = fzi state.links, state.query
else
state.scored_links = fzi state.links, state.query, "display_name"
else else
state.scored_links = orderBy(state.links, ['is_pinned', 'frequency'], ['desc', 'desc']) state.scored_links = orderBy(state.links, ['is_pinned', 'frequency'], ['desc', 'desc'])
@ -362,6 +365,7 @@ tag app
global.location.href = "https://github.com/familyfriendlymikey/fuzzyhome" global.location.href = "https://github.com/familyfriendlymikey/fuzzyhome"
def handle_paste e def handle_paste e
return unless config.enable_search_on_paste
return if state.query.length > 0 return if state.query.length > 0
global.setTimeout(&, 0) do global.setTimeout(&, 0) do
bang ||= config.default_bang bang ||= config.default_bang
@ -377,6 +381,21 @@ tag app
save_config! save_config!
settings_active = no settings_active = no
def handle_click_toggle_search_on_paste
config.enable_search_on_paste = not config.enable_search_on_paste
save_config!
settings_active = no
def handle_toggle_light_theme
config.enable_dark_theme = not config.enable_dark_theme
save_config!
settings_active = no
def handle_click_toggle_effective_names
config.enable_effective_names = not config.enable_effective_names
save_config!
settings_active = no
get pretty_date get pretty_date
Date!.toString!.split(" ").slice(0, 4).join(" ") Date!.toString!.split(" ").slice(0, 4).join(" ")
@ -541,11 +560,21 @@ tag app
@click=handle_click_toggle_buttons @click=handle_click_toggle_buttons
> >
config.enable_buttons ? "DISABLE BUTTONS" : "ENABLE BUTTONS" config.enable_buttons ? "DISABLE BUTTONS" : "ENABLE BUTTONS"
<.settings-container>
<.settings-button
@click=handle_click_toggle_search_on_paste
>
config.enable_search_on_paste ? "DISABLE SEARCH ON PASTE" : "ENABLE SEARCH ON PASTE"
<.settings-button
@click=handle_click_toggle_effective_names
>
config.enable_effective_names ? "DISABLE EFFECTIVE NAMES" : "ENABLE EFFECTIVE NAMES"
<.settings-container> <.settings-container>
<.settings-button <.settings-button
.disabled=loading .disabled=loading
@click.if(!loading)=handle_click_github @click.if(!loading)=handle_toggle_light_theme
> "LIGHT THEME" >
config.enable_dark_theme ? "DISABLE DARK THEME" : "ENABLE DARK THEME"
else else
<input$main-input <input$main-input
@ -618,7 +647,7 @@ tag app
<.display-name <.display-name
[c:#FAD4AB]=link.is_bang [c:#FAD4AB]=link.is_bang
> link.display_name > link.display_name
if link.display_name isnt link.name if link.display_name isnt link.name and config.enable_effective_names
<.name> <.name>
<span.parens> "(" <span.parens> "("
<span> link.name <span> link.name

6
app/config.imba

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save