3 Commits

5 changed files with 27 additions and 5 deletions

View File

@@ -8,7 +8,7 @@ import (
"golang.org/x/mod/semver" "golang.org/x/mod/semver"
) )
const Tag = "v0.0.9" const Tag = "v0.0.10"
var versionInfo struct { var versionInfo struct {
Local struct { Local struct {

View File

@@ -1,7 +1,20 @@
<div class="grid-x grid-padding-x"> <div class="grid-x grid-padding-x">
<div class="large-12 cell"> <div class="large-12 cell">
{{ if .clicked }}
<p>Drag the bookmarklet link below to your bookmarks bar, or right click
it, copy the link and add it to your bookmarks manually.</p>
<p>Then whenever you are on a webpage you would like to bookmark, just
click the bookmarklet.</p>
<a class="button" href="javascript:void(window.open('{{ .config.BaseURL }}/bookmarklet?url=' +encodeURIComponent(window.location), 'windowName', 'width=640,height=480'))">Bookmarklet</a>
{{ else }}
{{ template "add_url_form.html" .}} {{ template "add_url_form.html" .}}
{{ end }}
</div> </div>
</div> </div>

View File

@@ -20,7 +20,9 @@
<a href="{{ .URL }}">{{ niceURL .URL }}</a> <a href="{{ .URL }}">{{ niceURL .URL }}</a>
</td> </td>
<td> <td>
{{ join .Tags ", " }} {{ range .Tags }}
<span class="label primary">{{ . }}</span>
{{ end }}
</td> </td>
<td class="show-for-large">{{ (nicetime .TimestampCreated).HumanDuration }} ago</td> <td class="show-for-large">{{ (nicetime .TimestampCreated).HumanDuration }} ago</td>
<td class="show-for-large">{{ (nicetime .TimestampLastScraped).HumanDuration }} ago</td> <td class="show-for-large">{{ (nicetime .TimestampLastScraped).HumanDuration }} ago</td>

View File

@@ -12,11 +12,12 @@
<div class="small-12 large-6 cell"> <div class="small-12 large-6 cell">
{{ range .tags }} {{ range .tags }}
<a href="#" <a href="#"
class=""
title="remove {{ . }}" title="remove {{ . }}"
hx-trigger="click" hx-trigger="click"
hx-target="#label-widget" hx-target="#label-widget"
hx-post="/tags?remove={{ . }}">[-]</a> hx-post="/tags?remove={{ . }}">[-]</a>
{{ . }} <span class="label primary">{{ . }}</span>
{{ end }} {{ end }}
<input type="hidden" name="tags_hidden" value="{{ .tags_hidden }}"> <input type="hidden" name="tags_hidden" value="{{ .tags_hidden }}">

View File

@@ -220,8 +220,14 @@ func Create(bmm *db.BookmarkManager, cmm *db.ConfigManager) *Server {
r.GET("/bookmarklet", func(c *gin.Context) { r.GET("/bookmarklet", func(c *gin.Context) {
url := c.Query("url") url := c.Query("url")
log.Printf(url)
meta := gin.H{"page": "bookmarklet_click", "config": config, "url": url} meta := gin.H{"page": "bookmarklet_click", "config": config, "url": url}
// check if they just clicked it from the actual app
if strings.Index(url, config.BaseURL) == 0 {
meta["clicked"] = true
}
c.HTML(http.StatusOK, c.HTML(http.StatusOK,
"_layout.html", meta, "_layout.html", meta,
) )
@@ -250,7 +256,7 @@ func cleanupTags(tags []string) []string {
keys := make(map[string]struct{}) keys := make(map[string]struct{})
for _, k := range tags { for _, k := range tags {
if k != "" && k != "|" { if k != "" && k != "|" {
keys[k] = struct{}{} keys[strings.ToLower(k)] = struct{}{}
} }
} }
out := []string{} out := []string{}