From 843639c218e0d7c792d14337a5d7bdb0723f951d Mon Sep 17 00:00:00 2001 From: familyfriendlymikey Date: Wed, 31 Aug 2022 19:25:34 -0400 Subject: [PATCH] refactor: fix config --- app/api.imba | 71 +++++++ app/client.imba | 268 ++---------------------- app/components/app-community-links.imba | 6 + app/components/app-links.imba | 134 ++++++++++++ app/config.imba | 42 ++-- 5 files changed, 258 insertions(+), 263 deletions(-) create mode 100644 app/api.imba create mode 100644 app/components/app-links.imba diff --git a/app/api.imba b/app/api.imba new file mode 100644 index 0000000..74a1276 --- /dev/null +++ b/app/api.imba @@ -0,0 +1,71 @@ +import db from './db' +import state from './state' +import { omit, orderBy } from 'lodash' + +export default new class api + + def add_link text + let link = await create_link_from_text text + link.id = nanoid! + await db.links.add link + await reload_db! + imba.commit! + p omit(link, "icon") + return link + + def update_link old_link, new_link_text + let new_link = await create_link_from_text new_link_text + new_link.frequency = old_link.frequency + let result = await db.links.update old_link.id, new_link + throw "Link id not found." if result is 0 + await reload_db! + imba.commit! + p omit(old_link, "icon") + p omit(new_link, "icon") + return new_link + + def handle_delete link + def delete_link + try + await db.links.delete(link.id) + catch e + err "deleting link", e + try + await reload_db! + catch e + err "reloading db after successful delete", e + state.loading = yes + await delete_link! + state.query = prior_query + prior_query = '' + editing_link = no + sort_links! + selection_index = Math.min selection_index, state.sorted_links.length - 1 + state.loading = no + + def pin_link link + link.is_pinned = !link.is_pinned + try + let result = await db.links.update link.id, link + throw "Link id not found." if result is 0 + catch e + return err "pinning link", e + await reload_db! + imba.commit! + + def reload_db + state.links = await db.links.toArray() + sort_links! + + def increment_link_frequency link + try + await db.links.update link.id, { frequency: link.frequency + 1 } + catch e + err "putting link", e + + def sort_links + if state.query.trim!.length <= 0 + return state.sorted_links = orderBy(state.links, ['is_pinned', 'frequency'], ['desc', 'desc']) + if config.enable_effective_names + return state.sorted_links = fzi state.links, state.query + state.sorted_links = fzi state.links, state.query, "display_name" diff --git a/app/client.imba b/app/client.imba index 2953e99..20b166f 100644 --- a/app/client.imba +++ b/app/client.imba @@ -1,9 +1,14 @@ +# TODO, deal with these 3: +# editing_link = no +# prior_query = '' +# viewing_community_links = yes + + let p = console.log # import sw from './sw.imba?serviceworker' # navigator..serviceWorker..register(sw).then! do |reg| reg.update! -import { orderBy, omit } from 'lodash' import fzi from 'fzi' import download from 'downloadjs' import { nanoid } from 'nanoid' @@ -14,7 +19,8 @@ let version = pkg.version import { parse_url } from './utils' import db from './db' import state from './state' -import default_config from './config' +import api from './api' +import { config, save_config } from './config' import app-community-links from './components/app-community-links' import app-settings from './components/app-settings' @@ -34,15 +40,12 @@ global._fuzzyhome_delete_everything = do |prompt=yes| extend tag element get state state + get api + api tag app - selection_index = 0 fatal_error = no - bang = no - editing_link = no - prior_query = '' - viewing_community_links = yes get render? do mounted? @@ -51,13 +54,12 @@ tag app await add_initial_links! global.localStorage.fuzzyhome_visited = yes try - await reload_db! + await api.reload_db! p "links:", state.links catch e err "state.loading database", e fatal_error = yes return - await load_config! def add_initial_links let initial_links = [ @@ -72,43 +74,15 @@ tag app ] for link_text in initial_links try - add_link link_text + api.add_link link_text catch e err "adding link", e - def load_config - try - config = JSON.parse(global.localStorage.fuzzyhome_config) - validate_config! - catch - reset_config! - - def validate_config - p "config:", config - throw _ if config.default_bang.id == null - throw _ if config.default_bang.url == null - throw _ if config.default_bang.icon == null - throw _ if config.default_bang.name == null - throw _ if config.default_bang.frequency == null - throw _ if config.default_bang.display_name == null - - def reset_config - p "resetting config" - config = default_config - save_config! - - def save_config - global.localStorage.fuzzyhome_config = JSON.stringify(config) - def err s, e p "error:" p e window.alert("Error {s}:\n\n{e}") - def reload_db - state.links = await db.links.toArray() - sort_links! - get selected_link state.sorted_links[selection_index] @@ -131,22 +105,6 @@ tag app name = name.slice(1) name - def sort_links - let links = state.links - if state.query.trim!.length > 0 - if config.enable_effective_names - state.sorted_links = fzi links, state.query - else - state.sorted_links = fzi links, state.query, "display_name" - else - state.sorted_links = orderBy(links, ['is_pinned', 'frequency'], ['desc', 'desc']) - - def increment_link_frequency link - try - await db.links.update link.id, { frequency: link.frequency + 1 } - catch e - err "putting link", e - def toggle_settings settings_active = !settings_active @@ -215,22 +173,13 @@ tag app def handle_add state.loading = yes try - await add_link state.query + await api.add_link state.query state.query = '' sort_links! catch e err "adding link", e state.loading = no - def add_link text - let link = await create_link_from_text text - link.id = nanoid! - await db.links.add link - await reload_db! - imba.commit! - p omit(link, "icon") - return link - def construct_link_text link let link_text = "" link_text += "!" if link.is_bang @@ -254,21 +203,8 @@ tag app await edit_link! state.loading = no - def update_link old_link, new_link_text - let new_link = await create_link_from_text new_link_text - new_link.frequency = old_link.frequency - let result = await db.links.update old_link.id, new_link - throw "Link id not found." if result is 0 - await reload_db! - imba.commit! - p omit(old_link, "icon") - p omit(new_link, "icon") - return new_link - def handle_click_link link - if viewing_community_links - add_community_link link - elif link.is_bang + if link.is_bang state.query = '' bang = link else @@ -305,39 +241,11 @@ tag app return unless window.confirm "Do you really want to delete {link..display_name}?" handle_delete link - def handle_delete link - - def delete_link - try - await db.links.delete(link.id) - catch e - err "deleting link", e - try - await reload_db! - catch e - err "reloading db after successful delete", e - - state.loading = yes - await delete_link! - state.query = prior_query - prior_query = '' - editing_link = no - sort_links! - selection_index = Math.min selection_index, state.sorted_links.length - 1 - state.loading = no - def handle_click_edit link handle_edit link def handle_click_pin link - link.is_pinned = !link.is_pinned - try - let result = await db.links.update link.id, link - throw "Link id not found." if result is 0 - catch e - return err "pinning link", e - await reload_db! - imba.commit! + api.pin_link link def handle_shift_backspace if editing_link @@ -346,11 +254,6 @@ tag app return unless state.sorted_links.length > 0 handle_edit selected_link - def add_community_link link - await db.links.add link - await reload_db! - imba.commit! - def handle_shift_return def go if viewing_community_links @@ -425,11 +328,6 @@ tag app state.query = '' sort_links! - def handle_click_view_community_links - viewing_community_links = yes - settings_active = no - sort_links! - def render @@ -509,140 +407,16 @@ tag app Check developer console for more information. """ - if viewing_community_links - + elif $acl.active + - elif settings_active - + elif $as.active + - elif editing_link - + elif $ae.active + else - <.header> - css - d:flex fld:row w:100% - - css .side - c:purple3/90 fs:15px - d:flex ja:center w:30px - cursor:pointer - - css .side svg - w:15px - - css .left - d:flex jc:left - - css .right - d:flex jc:right - - <.side.left - @click=handle_click_toggle_simplify_ui - > - if config.enable_simplify_ui - - else - - - - - let m = math_result - if m isnt no and m.toString! isnt state.query.trim! - <.side.right[c:blue3 fs:20px ml:10px w:unset] - @click=handle_click_copy(m) - > "= {Math.round(m * 100)/100}" - else - <.side.right @click.if(!state.loading)=toggle_settings> - - - if config.enable_tips and not config.enable_simplify_ui - <.middle-button> - <.tip[jc:start ta:left fl:1] @click=handle_return> - <.tip-hotkey> "Return" - <.tip-content> "Navigate To Link" - <.tip[jc:center ta:center fl:2 px:15px] - @click=handle_shift_return - > - <.tip-hotkey> "Shift + Return" - <.tip-content[of:hidden text-overflow:ellipsis white-space:nowrap]> - "Add New Link" - " " - let sq = state.query.trim!.split /\s+/ - if sq.length >= 2 - let url = sq.pop! - '"' - sq.join ' ' - ' ' - url - '"' - else - '"' - sq.join ' ' - '"' - <.tip[jc:end ta:right fl:1] - @click=handle_shift_backspace - > - <.tip-hotkey> "Shift + Backspace" - <.tip-content> "Edit Link" - - <.links> - if not viewing_community_links and (bang or state.sorted_links.length < 1) - - <.link-left> - - <.display-name.bang-text> encoded_bang_query - <.link-right[jc:flex-end]> - <.frequency> active_bang.frequency - else - for link, index in state.sorted_links - - <.link-left> - - <.display-name - [c:#FAD4AB]=link.is_bang - > link.display_name - if link.display_name isnt link.name and config.enable_effective_names - <.name> - "(" - link.name - ")" - <.link-right> - <.link-buttons .buttons-disabled=(not config.enable_buttons or config.enable_simplify_ui)> - <.link-button@click.prevent.stop=handle_click_edit(link)> - - <.link-button@click.prevent.stop=handle_click_delete(link)> - - <.link-button - @click.prevent.stop=handle_click_pin(link) - [visibility:visible c:purple3/50]=(link.is_pinned and (index isnt selection_index or not config.enable_buttons or config.enable_simplify_ui)) - > - - <.frequency> link.frequency - $main-input.focus! imba.mount diff --git a/app/components/app-community-links.imba b/app/components/app-community-links.imba index 901d131..964c12c 100644 --- a/app/components/app-community-links.imba +++ b/app/components/app-community-links.imba @@ -24,6 +24,11 @@ tag app-community-links let rest = split_text.join " " { url, rest } + def add_community_link link + await db.links.add link + await reload_db! + imba.commit! + def render let { url, rest } = get_link_obj link_text <.link-left .bang=rest.startsWith("!")> rest diff --git a/app/components/app-links.imba b/app/components/app-links.imba new file mode 100644 index 0000000..641b26a --- /dev/null +++ b/app/components/app-links.imba @@ -0,0 +1,134 @@ +tag app-links + + selection_index = 0 + bang = no + + def mount + $links-input.focus! + + def render + + + + <.header> + css + d:flex fld:row w:100% + + css .side + c:purple3/90 fs:15px + d:flex ja:center w:30px + cursor:pointer + + css .side svg + w:15px + + css .left + d:flex jc:left + + css .right + d:flex jc:right + + <.side.left + @click=handle_click_toggle_simplify_ui + > + if config.enable_simplify_ui + + else + + + + + let m = math_result + if m isnt no and m.toString! isnt state.query.trim! + <.side.right[c:blue3 fs:20px ml:10px w:unset] + @click=handle_click_copy(m) + > "= {Math.round(m * 100)/100}" + else + <.side.right @click.if(!state.loading)=toggle_settings> + + + if config.enable_tips and not config.enable_simplify_ui + <.middle-button> + <.tip[jc:start ta:left fl:1] @click=handle_return> + <.tip-hotkey> "Return" + <.tip-content> "Navigate To Link" + <.tip[jc:center ta:center fl:2 px:15px] + @click=handle_shift_return + > + <.tip-hotkey> "Shift + Return" + <.tip-content[of:hidden text-overflow:ellipsis white-space:nowrap]> + "Add New Link" + " " + let sq = state.query.trim!.split /\s+/ + if sq.length >= 2 + let url = sq.pop! + '"' + sq.join ' ' + ' ' + url + '"' + else + '"' + sq.join ' ' + '"' + <.tip[jc:end ta:right fl:1] + @click=handle_shift_backspace + > + <.tip-hotkey> "Shift + Backspace" + <.tip-content> "Edit Link" + + <.links> + if not viewing_community_links and (bang or state.sorted_links.length < 1) + + <.link-left> + + <.display-name.bang-text> encoded_bang_query + <.link-right[jc:flex-end]> + <.frequency> active_bang.frequency + else + for link, index in state.sorted_links + + <.link-left> + + <.display-name + [c:#FAD4AB]=link.is_bang + > link.display_name + if link.display_name isnt link.name and config.enable_effective_names + <.name> + "(" + link.name + ")" + <.link-right> + <.link-buttons .buttons-disabled=(not config.enable_buttons or config.enable_simplify_ui)> + <.link-button@click.prevent.stop=handle_click_edit(link)> + + <.link-button@click.prevent.stop=handle_click_delete(link)> + + <.link-button + @click.prevent.stop=handle_click_pin(link) + [visibility:visible c:purple3/50]=(link.is_pinned and (index isnt selection_index or not config.enable_buttons or config.enable_simplify_ui)) + > + + <.frequency> link.frequency diff --git a/app/config.imba b/app/config.imba index 4d2005d..cb26c6e 100644 --- a/app/config.imba +++ b/app/config.imba @@ -1,19 +1,29 @@ -let config = {} +let { data, save } = new class config -config.default_bang = { - "name": "!google" - "display_name": "google" - "url": "https://www.google.com/search?q=" - "frequency": 0 - "icon": "data:image/x-icon;base64,AAABAAIAEBAAAAEAIABoBAAAJgAAACAgAAABACAAqBAAAI4EAAAoAAAAEAAAACAAAAABACAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///zD9/f2W/f392P39/fn9/f35/f391/39/ZT+/v4uAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/v7+Cf39/Zn///////////////////////////////////////////39/ZX///8IAAAAAAAAAAAAAAAA/v7+Cf39/cH/////+v35/7TZp/92ul3/WKs6/1iqOv9yuFn/rNWd//j79v///////f39v////wgAAAAAAAAAAP39/Zn/////7PXp/3G3WP9TqDT/U6g0/1OoNP9TqDT/U6g0/1OoNP+Or1j//vDo///////9/f2VAAAAAP///zD/////+vz5/3G3V/9TqDT/WKo6/6LQkf/U6cz/1urO/6rUm/+Zo0r/8IZB//adZ////v7///////7+/i79/f2Y/////4nWzf9Lqkj/Vqo4/9Xqzv///////////////////////ebY//SHRv/0hUL//NjD///////9/f2U/f392v////8sxPH/Ebzt/43RsP/////////////////////////////////4roL/9IVC//i1jf///////f391/39/fr/////Cr37/wW8+/+16/7/////////////////9IVC//SFQv/0hUL/9IVC//SFQv/3pnX///////39/fn9/f36/////wu++/8FvPv/tuz+//////////////////SFQv/0hUL/9IVC//SFQv/0hUL/96p7///////9/f35/f392/////81yfz/CrL5/2uk9v///////////////////////////////////////////////////////f392P39/Zn/////ks/7/zdS7P84Rur/0NT6///////////////////////9/f////////////////////////39/Zb+/v4y//////n5/v9WYu3/NUPq/ztJ6/+VnPT/z9L6/9HU+v+WnfT/Ul7t/+Hj/P////////////////////8wAAAAAP39/Z3/////6Or9/1hj7v81Q+r/NUPq/zVD6v81Q+r/NUPq/zVD6v9sdvD////////////9/f2YAAAAAAAAAAD///8K/f39w//////5+f7/paz2/11p7v88Suv/Okfq/1pm7v+iqfX/+fn+///////9/f3B/v7+CQAAAAAAAAAAAAAAAP///wr9/f2d///////////////////////////////////////////9/f2Z/v7+CQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP7+/jL9/f2Z/f392/39/fr9/f36/f392v39/Zj///8wAAAAAAAAAAAAAAAAAAAAAPAPAADAAwAAgAEAAIABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIABAACAAQAAwAMAAPAPAAAoAAAAIAAAAEAAAAABACAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP7+/g3+/v5X/f39mf39/cj9/f3q/f39+f39/fn9/f3q/f39yP39/Zn+/v5W////DAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP7+/iT9/f2c/f399f/////////////////////////////////////////////////////9/f31/f39mv7+/iMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP7+/gn9/f2K/f39+////////////////////////////////////////////////////////////////////////////f39+v39/Yf///8IAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD+/v4k/f390v////////////////////////////////////////////////////////////////////////////////////////////////39/dD///8iAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////MP39/er//////////////////////////+r05v+v16H/gsBs/2WxSf9Wqjj/Vqk3/2OwRv99vWX/pdKV/97u2P////////////////////////////39/ej+/v4vAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP7+/iT9/f3q/////////////////////+v15/+Pxnv/VKk2/1OoNP9TqDT/U6g0/1OoNP9TqDT/U6g0/1OoNP9TqDT/U6g0/36+Z//d7tf///////////////////////39/ej///8iAAAAAAAAAAAAAAAAAAAAAAAAAAD///8K/f390//////////////////////E4bn/XKw+/1OoNP9TqDT/U6g0/1OoNP9TqDT/U6g0/1OoNP9TqDT/U6g0/1OoNP9TqDT/U6g0/1apN/+x0pv///////////////////////39/dD///8IAAAAAAAAAAAAAAAAAAAAAP39/Yv/////////////////////sdij/1OoNP9TqDT/U6g0/1OoNP9TqDT/U6g0/1OoNP9TqDT/U6g0/1OoNP9TqDT/U6g0/1OoNP9TqDT/YKU1/8qOPv/5wZ////////////////////////39/YcAAAAAAAAAAAAAAAD+/v4l/f39+////////////////8Lgt/9TqDT/U6g0/1OoNP9TqDT/U6g0/1OoNP9utlT/n86N/7faqv+426v/pdKV/3u8ZP9UqDX/U6g0/3egN//jiUH/9IVC//SFQv/82MP//////////////////f39+v7+/iMAAAAAAAAAAP39/Z3////////////////q9Ob/W6w+/1OoNP9TqDT/U6g0/1OoNP9nskz/zOXC/////////////////////////////////+Dv2v+osWP/8YVC//SFQv/0hUL/9IVC//WQVP/++fb//////////////////f39mgAAAAD+/v4O/f399v///////////////4LHj/9TqDT/U6g0/1OoNP9TqDT/dblc//L58P/////////////////////////////////////////////8+v/3p3f/9IVC//SFQv/0hUL/9IVC//rIqf/////////////////9/f31////DP7+/ln////////////////f9v7/Cbz2/zOwhv9TqDT/U6g0/2KwRv/v9+z///////////////////////////////////////////////////////738//1kFT/9IVC//SFQv/0hUL/9plg///////////////////////+/v5W/f39nP///////////////4jf/f8FvPv/Bbz7/yG1s/9QqDz/vN2w//////////////////////////////////////////////////////////////////rHqP/0hUL/9IVC//SFQv/0hUL//vDn//////////////////39/Zn9/f3L////////////////R878/wW8+/8FvPv/Bbz7/y7C5P/7/fr//////////////////////////////////////////////////////////////////ere//SFQv/0hUL/9IVC//SFQv/718H//////////////////f39yP39/ez///////////////8cwvv/Bbz7/wW8+/8FvPv/WNL8///////////////////////////////////////0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//rIqv/////////////////9/f3q/f39+v///////////////we9+/8FvPv/Bbz7/wW8+/993P3///////////////////////////////////////SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/+cGf//////////////////39/fn9/f36////////////////B737/wW8+/8FvPv/Bbz7/33c/f//////////////////////////////////////9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/6xaX//////////////////f39+f39/e3///////////////8cwvv/Bbz7/wW8+/8FvPv/WdP8///////////////////////////////////////0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//vVv//////////////////9/f3q/f39y////////////////0bN/P8FvPv/Bbz7/wW8+/8hrvn/+/v///////////////////////////////////////////////////////////////////////////////////////////////////////////////////39/cj9/f2c////////////////ht/9/wW8+/8FvPv/FZP1/zRJ6/+zuPf//////////////////////////////////////////////////////////////////////////////////////////////////////////////////f39mf7+/lr////////////////d9v7/B7n7/yB38f81Q+r/NUPq/0hV7P/u8P3////////////////////////////////////////////////////////////////////////////////////////////////////////////+/v5X////D/39/ff///////////////9tkPT/NUPq/zVD6v81Q+r/NUPq/2Fs7//y8v7////////////////////////////////////////////09f7//////////////////////////////////////////////////f399f7+/g0AAAAA/f39n////////////////+Tm/P89Suv/NUPq/zVD6v81Q+r/NUPq/1Bc7f/IzPn/////////////////////////////////x8v5/0xY7P+MlPP////////////////////////////////////////////9/f2cAAAAAAAAAAD+/v4n/f39/P///////////////7W69/81Q+r/NUPq/zVD6v81Q+r/NUPq/zVD6v9ZZe7/k5v0/6609/+vtff/lJv0/1pm7v81Q+r/NUPq/zVD6v+GjvL//v7//////////////////////////////f39+/7+/iQAAAAAAAAAAAAAAAD9/f2N/////////////////////6Cn9f81Q+r/NUPq/zVD6v81Q+r/NUPq/zVD6v81Q+r/NUPq/zVD6v81Q+r/NUPq/zVD6v81Q+r/NUPq/zVD6v+BivL////////////////////////////9/f2KAAAAAAAAAAAAAAAAAAAAAP7+/gv9/f3V/////////////////////7W69/8+S+v/NUPq/zVD6v81Q+r/NUPq/zVD6v81Q+r/NUPq/zVD6v81Q+r/NUPq/zVD6v81Q+r/P0zr/7q/+P///////////////////////f390v7+/gkAAAAAAAAAAAAAAAAAAAAAAAAAAP7+/ib9/f3r/////////////////////+Xn/P94gfH/NkTq/zVD6v81Q+r/NUPq/zVD6v81Q+r/NUPq/zVD6v81Q+r/NkTq/3Z/8f/l5/z///////////////////////39/er+/v4kAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP7+/jL9/f3r///////////////////////////k5vz/nqX1/2p08P9IVez/OEbq/zdF6v9GU+z/aHLv/5qh9f/i5Pz////////////////////////////9/f3q////MAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP7+/ib9/f3V/////////////////////////////////////////////////////////////////////////////////////////////////f390v7+/iQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wr9/f2N/f39/P///////////////////////////////////////////////////////////////////////////f39+/39/Yv+/v4JAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD+/v4n/f39n/39/ff//////////////////////////////////////////////////////f399v39/Z3+/v4lAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/v7+Dv7+/lr9/f2c/f39y/39/e39/f36/f39+v39/ez9/f3L/f39nP7+/ln+/v4OAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/AA///AAD//AAAP/gAAB/wAAAP4AAAB8AAAAPAAAADgAAAAYAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAABgAAAAcAAAAPAAAAD4AAAB/AAAA/4AAAf/AAAP/8AAP//wAP/" - "id": "FEJbsKLUMwHbazbqW3c4i" -} + def constructor + this.data = {} + try + this.data = JSON.parse(global.localStorage.fuzzyhome_config) + + this.data.enable_tips ??= yes + this.data.enable_buttons ??= yes + this.data.enable_search_on_paste ??= yes + this.data.enable_dark_theme ??= yes + this.data.enable_effective_names ??= yes + this.data.enable_simplify_ui ??= no -config.enable_tips = yes -config.enable_buttons = yes -config.enable_search_on_paste = yes -config.enable_dark_theme = yes -config.enable_effective_names = yes -config.enable_simplify_ui = no + this.data.default_bang ??= {} + this.data.default_bang.name ??= "!google" + this.data.default_bang.display_name ??= "google" + this.data.default_bang.url ??= "https://www.google.com/search?q=" + this.data.default_bang.frequency ??= 0 + this.data.default_bang.icon ??= "data:image/x-icon;base64,AAABAAIAEBAAAAEAIABoBAAAJgAAACAgAAABACAAqBAAAI4EAAAoAAAAEAAAACAAAAABACAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///zD9/f2W/f392P39/fn9/f35/f391/39/ZT+/v4uAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/v7+Cf39/Zn///////////////////////////////////////////39/ZX///8IAAAAAAAAAAAAAAAA/v7+Cf39/cH/////+v35/7TZp/92ul3/WKs6/1iqOv9yuFn/rNWd//j79v///////f39v////wgAAAAAAAAAAP39/Zn/////7PXp/3G3WP9TqDT/U6g0/1OoNP9TqDT/U6g0/1OoNP+Or1j//vDo///////9/f2VAAAAAP///zD/////+vz5/3G3V/9TqDT/WKo6/6LQkf/U6cz/1urO/6rUm/+Zo0r/8IZB//adZ////v7///////7+/i79/f2Y/////4nWzf9Lqkj/Vqo4/9Xqzv///////////////////////ebY//SHRv/0hUL//NjD///////9/f2U/f392v////8sxPH/Ebzt/43RsP/////////////////////////////////4roL/9IVC//i1jf///////f391/39/fr/////Cr37/wW8+/+16/7/////////////////9IVC//SFQv/0hUL/9IVC//SFQv/3pnX///////39/fn9/f36/////wu++/8FvPv/tuz+//////////////////SFQv/0hUL/9IVC//SFQv/0hUL/96p7///////9/f35/f392/////81yfz/CrL5/2uk9v///////////////////////////////////////////////////////f392P39/Zn/////ks/7/zdS7P84Rur/0NT6///////////////////////9/f////////////////////////39/Zb+/v4y//////n5/v9WYu3/NUPq/ztJ6/+VnPT/z9L6/9HU+v+WnfT/Ul7t/+Hj/P////////////////////8wAAAAAP39/Z3/////6Or9/1hj7v81Q+r/NUPq/zVD6v81Q+r/NUPq/zVD6v9sdvD////////////9/f2YAAAAAAAAAAD///8K/f39w//////5+f7/paz2/11p7v88Suv/Okfq/1pm7v+iqfX/+fn+///////9/f3B/v7+CQAAAAAAAAAAAAAAAP///wr9/f2d///////////////////////////////////////////9/f2Z/v7+CQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP7+/jL9/f2Z/f392/39/fr9/f36/f392v39/Zj///8wAAAAAAAAAAAAAAAAAAAAAPAPAADAAwAAgAEAAIABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIABAACAAQAAwAMAAPAPAAAoAAAAIAAAAEAAAAABACAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP7+/g3+/v5X/f39mf39/cj9/f3q/f39+f39/fn9/f3q/f39yP39/Zn+/v5W////DAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP7+/iT9/f2c/f399f/////////////////////////////////////////////////////9/f31/f39mv7+/iMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP7+/gn9/f2K/f39+////////////////////////////////////////////////////////////////////////////f39+v39/Yf///8IAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD+/v4k/f390v////////////////////////////////////////////////////////////////////////////////////////////////39/dD///8iAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////MP39/er//////////////////////////+r05v+v16H/gsBs/2WxSf9Wqjj/Vqk3/2OwRv99vWX/pdKV/97u2P////////////////////////////39/ej+/v4vAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP7+/iT9/f3q/////////////////////+v15/+Pxnv/VKk2/1OoNP9TqDT/U6g0/1OoNP9TqDT/U6g0/1OoNP9TqDT/U6g0/36+Z//d7tf///////////////////////39/ej///8iAAAAAAAAAAAAAAAAAAAAAAAAAAD///8K/f390//////////////////////E4bn/XKw+/1OoNP9TqDT/U6g0/1OoNP9TqDT/U6g0/1OoNP9TqDT/U6g0/1OoNP9TqDT/U6g0/1apN/+x0pv///////////////////////39/dD///8IAAAAAAAAAAAAAAAAAAAAAP39/Yv/////////////////////sdij/1OoNP9TqDT/U6g0/1OoNP9TqDT/U6g0/1OoNP9TqDT/U6g0/1OoNP9TqDT/U6g0/1OoNP9TqDT/YKU1/8qOPv/5wZ////////////////////////39/YcAAAAAAAAAAAAAAAD+/v4l/f39+////////////////8Lgt/9TqDT/U6g0/1OoNP9TqDT/U6g0/1OoNP9utlT/n86N/7faqv+426v/pdKV/3u8ZP9UqDX/U6g0/3egN//jiUH/9IVC//SFQv/82MP//////////////////f39+v7+/iMAAAAAAAAAAP39/Z3////////////////q9Ob/W6w+/1OoNP9TqDT/U6g0/1OoNP9nskz/zOXC/////////////////////////////////+Dv2v+osWP/8YVC//SFQv/0hUL/9IVC//WQVP/++fb//////////////////f39mgAAAAD+/v4O/f399v///////////////4LHj/9TqDT/U6g0/1OoNP9TqDT/dblc//L58P/////////////////////////////////////////////8+v/3p3f/9IVC//SFQv/0hUL/9IVC//rIqf/////////////////9/f31////DP7+/ln////////////////f9v7/Cbz2/zOwhv9TqDT/U6g0/2KwRv/v9+z///////////////////////////////////////////////////////738//1kFT/9IVC//SFQv/0hUL/9plg///////////////////////+/v5W/f39nP///////////////4jf/f8FvPv/Bbz7/yG1s/9QqDz/vN2w//////////////////////////////////////////////////////////////////rHqP/0hUL/9IVC//SFQv/0hUL//vDn//////////////////39/Zn9/f3L////////////////R878/wW8+/8FvPv/Bbz7/y7C5P/7/fr//////////////////////////////////////////////////////////////////ere//SFQv/0hUL/9IVC//SFQv/718H//////////////////f39yP39/ez///////////////8cwvv/Bbz7/wW8+/8FvPv/WNL8///////////////////////////////////////0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//rIqv/////////////////9/f3q/f39+v///////////////we9+/8FvPv/Bbz7/wW8+/993P3///////////////////////////////////////SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/+cGf//////////////////39/fn9/f36////////////////B737/wW8+/8FvPv/Bbz7/33c/f//////////////////////////////////////9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/6xaX//////////////////f39+f39/e3///////////////8cwvv/Bbz7/wW8+/8FvPv/WdP8///////////////////////////////////////0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//SFQv/0hUL/9IVC//vVv//////////////////9/f3q/f39y////////////////0bN/P8FvPv/Bbz7/wW8+/8hrvn/+/v///////////////////////////////////////////////////////////////////////////////////////////////////////////////////39/cj9/f2c////////////////ht/9/wW8+/8FvPv/FZP1/zRJ6/+zuPf//////////////////////////////////////////////////////////////////////////////////////////////////////////////////f39mf7+/lr////////////////d9v7/B7n7/yB38f81Q+r/NUPq/0hV7P/u8P3////////////////////////////////////////////////////////////////////////////////////////////////////////////+/v5X////D/39/ff///////////////9tkPT/NUPq/zVD6v81Q+r/NUPq/2Fs7//y8v7////////////////////////////////////////////09f7//////////////////////////////////////////////////f399f7+/g0AAAAA/f39n////////////////+Tm/P89Suv/NUPq/zVD6v81Q+r/NUPq/1Bc7f/IzPn/////////////////////////////////x8v5/0xY7P+MlPP////////////////////////////////////////////9/f2cAAAAAAAAAAD+/v4n/f39/P///////////////7W69/81Q+r/NUPq/zVD6v81Q+r/NUPq/zVD6v9ZZe7/k5v0/6609/+vtff/lJv0/1pm7v81Q+r/NUPq/zVD6v+GjvL//v7//////////////////////////////f39+/7+/iQAAAAAAAAAAAAAAAD9/f2N/////////////////////6Cn9f81Q+r/NUPq/zVD6v81Q+r/NUPq/zVD6v81Q+r/NUPq/zVD6v81Q+r/NUPq/zVD6v81Q+r/NUPq/zVD6v+BivL////////////////////////////9/f2KAAAAAAAAAAAAAAAAAAAAAP7+/gv9/f3V/////////////////////7W69/8+S+v/NUPq/zVD6v81Q+r/NUPq/zVD6v81Q+r/NUPq/zVD6v81Q+r/NUPq/zVD6v81Q+r/P0zr/7q/+P///////////////////////f390v7+/gkAAAAAAAAAAAAAAAAAAAAAAAAAAP7+/ib9/f3r/////////////////////+Xn/P94gfH/NkTq/zVD6v81Q+r/NUPq/zVD6v81Q+r/NUPq/zVD6v81Q+r/NkTq/3Z/8f/l5/z///////////////////////39/er+/v4kAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP7+/jL9/f3r///////////////////////////k5vz/nqX1/2p08P9IVez/OEbq/zdF6v9GU+z/aHLv/5qh9f/i5Pz////////////////////////////9/f3q////MAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP7+/ib9/f3V/////////////////////////////////////////////////////////////////////////////////////////////////f390v7+/iQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wr9/f2N/f39/P///////////////////////////////////////////////////////////////////////////f39+/39/Yv+/v4JAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD+/v4n/f39n/39/ff//////////////////////////////////////////////////////f399v39/Z3+/v4lAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/v7+Dv7+/lr9/f2c/f39y/39/e39/f36/f39+v39/ez9/f3L/f39nP7+/ln+/v4OAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/AA///AAD//AAAP/gAAB/wAAAP4AAAB8AAAAPAAAADgAAAAYAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAABgAAAAcAAAAPAAAAD4AAAB/AAAA/4AAAf/AAAP/8AAP//wAP/" + this.data.default_bang.id ??= "FEJbsKLUMwHbazbqW3c4i" -export default config + def save + global.localStorage.fuzzyhome_config = JSON.stringify(this.data) + +export { + data as config + save as save_config +}