Improve UX for the bookmarklet, if the user clicks instead of dragging, provide a prompt
This commit is contained in:
parent
f8060fbef6
commit
360c3fcc11
@ -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>
|
@ -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,
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user