let fallback = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAH0lEQVR42mO8seXffwYqAsZRA0cNHDVw1MBRA0eqgQCDRkbJSQHxEQAAAABJRU5ErkJggg=='
@ -189,10 +177,11 @@ tag app
await db.links.add link
await reload_db!
imba.commit!
return link
def handle_edit link
def edit_link
let input = window.prompt "Enter the new link name and url:"
let input = window.prompt "Enter the new link name and url:", "{link.name} {link.url}"
return if input === null
try
await update_link link, input
@ -209,38 +198,37 @@ tag app
throw "link id not found" if result === 0
await reload_db!
imba.commit!
return new_link
def handle_click_link link
await increment_link_frequency link
window.location.href = link.url
def handle_click_search
increment_search_engine_frequency!
def handle_bang
return unless bang
let url = encoded_bang_query
await increment_link_frequency bang
window.location.href = url
await increment_link_frequency active_bang
window.location.href = encoded_bang_query
def handle_click_bang
handle_bang!
def navigate link
await increment_link_frequency link
window.location.href = link.url
def handle_return
if bang
handle_bang!
elif state.scored_links.length < 1
use_search_engine!
if bang or state.scored_links.length < 1
return handle_bang!
let link = state.scored_links[selection_index]
if link.name.startsWith '!'
state.query = ''
bang = link
else
let link = state.scored_links[selection_index]
await increment_link_frequency link
window.location.href = link.url
navigate link
def handle_tab
return bang = no if bang
return unless state.scored_links.length > 0
state.query = ''
bang = state.scored_links[selection_index]
def handle_del
if state.query.length < 1
bang = no
sort_links!
def handle_click_delete link
handle_delete link
@ -306,31 +294,14 @@ tag app
settings_active = no
loading = no
def handle_click_config
def edit_config
let input = window.prompt "Please enter the URL of your search engine."