Browse Source

make links open in new tab properly

main
familyfriendlymikey 2 years ago
parent
commit
b40066755f
  1. 16
      app/client.imba
  2. 2
      package.json
  3. 2
      sw.imba

16
app/client.imba

@ -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>

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "fuzzyhome", "name": "fuzzyhome",
"version": "0.0.29", "version": "0.0.30",
"scripts": { "scripts": {
"start": "imba run -SMH --baseurl . -w server.imba", "start": "imba run -SMH --baseurl . -w server.imba",
"build-app": "rm -rf dist && imba build -SMH --baseurl . server.imba", "build-app": "rm -rf dist && imba build -SMH --baseurl . server.imba",

2
sw.imba

@ -1,7 +1,7 @@
let p = console.log let p = console.log
const app_prefix = "fuzzyhome_cache" const app_prefix = "fuzzyhome_cache"
const version = "0.0.29" const version = "0.0.30"
const cache_name = "{app_prefix}-{version}" const cache_name = "{app_prefix}-{version}"

Loading…
Cancel
Save