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