fix template icon small
This commit is contained in:
parent
2d4138c00e
commit
b4f2095fa5
2 changed files with 14 additions and 18 deletions
17
src/main.go
17
src/main.go
|
@ -52,7 +52,11 @@ func prepare() {
|
|||
|
||||
dataPath := filepath.Join(pwd, "data")
|
||||
os.MkdirAll(dataPath, os.ModePerm)
|
||||
os.MkdirAll(filepath.Join(dataPath, "icon"), os.ModePerm)
|
||||
|
||||
iconPath := filepath.Join(dataPath, "icon")
|
||||
os.RemoveAll(iconPath)
|
||||
os.MkdirAll(iconPath, os.ModePerm)
|
||||
|
||||
modules.CopyDir(filepath.Join(pwd, "common"), dataPath, false)
|
||||
}
|
||||
|
||||
|
@ -66,10 +70,13 @@ func loadData() {
|
|||
for group := 0; group < len(websiteData.Contents); group++ {
|
||||
for col := 0; col < len(websiteData.Contents[group].Columns); col++ {
|
||||
for bookmark := 0; bookmark < len(websiteData.Contents[group].Columns[col].Bookmarks); bookmark++ {
|
||||
iconPath := websiteData.Contents[group].Columns[col].Bookmarks[bookmark].Icon
|
||||
fileName := path.Base(iconPath)
|
||||
if modules.DownloadFile(iconPath, filepath.Join(pwd, "data", "icon", fileName)) {
|
||||
websiteData.Contents[group].Columns[col].Bookmarks[bookmark].Icon = "/common/icon/" + fileName
|
||||
bookmarkData := websiteData.Contents[group].Columns[col].Bookmarks[bookmark]
|
||||
if bookmarkData.IsImage() || bookmarkData.IsSVG() {
|
||||
iconPath := bookmarkData.Icon
|
||||
fileName := path.Base(iconPath)
|
||||
if modules.DownloadFile(iconPath, filepath.Join(pwd, "data", "icon", fileName)) {
|
||||
websiteData.Contents[group].Columns[col].Bookmarks[bookmark].Icon = "/common/icon/" + fileName
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,20 +71,9 @@
|
|||
{{if .IsImage}}
|
||||
<img src="{{.Icon}}" class="icon">
|
||||
{{else if .IsSVG}}
|
||||
<svg-file src="{{.Icon}}" class="svg-icon">
|
||||
<style>
|
||||
path:nth-child(2n+2) {
|
||||
fill: var(--foreground); /* shadowDOM style does NOT style global DOM */
|
||||
}
|
||||
svg {
|
||||
fill: var(--foreground);
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
}
|
||||
</style>
|
||||
</svg-file>
|
||||
<svg-file src="{{.Icon}}" class="svg-icon"></svg-file>
|
||||
{{else}}
|
||||
<i class="{{.Icon}} fa-xl icon"></i>
|
||||
<i class="{{.Icon}} fa-2xl icon"></i>
|
||||
{{end}}
|
||||
</div>
|
||||
<h6>{{.Name}}</h6>
|
||||
|
|
Loading…
Add table
Reference in a new issue