|
@ -53,12 +53,6 @@ tag app |
|
|
state.links = await db.reload! |
|
|
state.links = await db.reload! |
|
|
sort_links! |
|
|
sort_links! |
|
|
|
|
|
|
|
|
def navigate link |
|
|
|
|
|
link.last_opened = Date.now! |
|
|
|
|
|
link.frequency = link.frequency + 1 |
|
|
|
|
|
await db.put link |
|
|
|
|
|
window.location.href = "//{link.link}" |
|
|
|
|
|
|
|
|
|
|
|
def sort_links |
|
|
def sort_links |
|
|
if state.query.trim!.length > 0 |
|
|
if state.query.trim!.length > 0 |
|
|
state.scored_links = fzy state.links, state.query |
|
|
state.scored_links = fzy state.links, state.query |
|
@ -66,6 +60,11 @@ tag app |
|
|
state.scored_links = sortBy(state.links) do |link| |
|
|
state.scored_links = sortBy(state.links) do |link| |
|
|
-link.frequency |
|
|
-link.frequency |
|
|
|
|
|
|
|
|
|
|
|
def navigate link |
|
|
|
|
|
link.last_opened = Date.now! |
|
|
|
|
|
link.frequency = link.frequency + 1 |
|
|
|
|
|
await db.put link |
|
|
|
|
|
|
|
|
def handle_click_link link |
|
|
def handle_click_link link |
|
|
navigate link |
|
|
navigate link |
|
|
|
|
|
|
|
@ -332,9 +331,10 @@ tag app |
|
|
if state.scored_links.length > 0 |
|
|
if state.scored_links.length > 0 |
|
|
<.links> |
|
|
<.links> |
|
|
for obj, index in state.scored_links |
|
|
for obj, index in state.scored_links |
|
|
<.link |
|
|
<a.link |
|
|
|
|
|
href="//{obj.link}" |
|
|
@pointerover=(selection_index = index) |
|
|
@pointerover=(selection_index = index) |
|
|
@click.prevent=handle_click_link(obj) |
|
|
@click=handle_click_link(obj) |
|
|
.selected=(index == selection_index) |
|
|
.selected=(index == selection_index) |
|
|
> |
|
|
> |
|
|
<.link-left> |
|
|
<.link-left> |
|
|