Emoji Favicons (#90)
This commit is contained in:
parent
3cb15cb257
commit
cceedfac15
|
@ -71,7 +71,7 @@ func bkmkInit() {
|
||||||
// It also accepts a bool indicating whether this page already has a bookmark.
|
// It also accepts a bool indicating whether this page already has a bookmark.
|
||||||
// It returns the bookmark name and the bookmark action:
|
// It returns the bookmark name and the bookmark action:
|
||||||
// 1, 0, -1 for add/update, cancel, and remove
|
// 1, 0, -1 for add/update, cancel, and remove
|
||||||
func openBkmkModal(name string, exists bool) (string, int) {
|
func openBkmkModal(name string, exists bool, favicon string) (string, int) {
|
||||||
// Basically a copy of Input()
|
// Basically a copy of Input()
|
||||||
|
|
||||||
// Reset buttons before input field, to make sure the input is in focus
|
// Reset buttons before input field, to make sure the input is in focus
|
||||||
|
@ -86,6 +86,9 @@ func openBkmkModal(name string, exists bool) (string, int) {
|
||||||
|
|
||||||
// Remove and re-add input field - to clear the old text
|
// Remove and re-add input field - to clear the old text
|
||||||
bkmkModal.GetForm().Clear(false)
|
bkmkModal.GetForm().Clear(false)
|
||||||
|
if favicon != "" && !exists {
|
||||||
|
name = favicon + " " + name
|
||||||
|
}
|
||||||
bkmkModalText = ""
|
bkmkModalText = ""
|
||||||
bkmkModal.GetForm().AddInputField("Name: ", name, 0, nil,
|
bkmkModal.GetForm().AddInputField("Name: ", name, 0, nil,
|
||||||
func(text string) {
|
func(text string) {
|
||||||
|
@ -136,10 +139,10 @@ func addBookmark() {
|
||||||
// Can't make bookmarks for other kinds of URLs
|
// Can't make bookmarks for other kinds of URLs
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
curPage := tabs[curTab].page
|
||||||
name, exists := bookmarks.Get(tabs[curTab].page.URL)
|
name, exists := bookmarks.Get(curPage.URL)
|
||||||
// Open a bookmark modal with the current name of the bookmark, if it exists
|
// Open a bookmark modal with the current name of the bookmark, if it exists
|
||||||
newName, action := openBkmkModal(name, exists)
|
newName, action := openBkmkModal(name, exists, curPage.Favicon)
|
||||||
switch action {
|
switch action {
|
||||||
case 1:
|
case 1:
|
||||||
// Add/change the bookmark
|
// Add/change the bookmark
|
||||||
|
|
Loading…
Reference in New Issue