mirror of
https://gitea.phreedom.club/localhost_frssoft/bloat.git
synced 2024-11-25 06:09:22 +02:00
Manual selecting emojis on page by codes contain
This commit is contained in:
parent
5f688c6318
commit
f219ac0dca
|
@ -40,6 +40,16 @@ type TemplateData struct {
|
||||||
Ctx *Context
|
Ctx *Context
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
func allowed_emoji_page(emoj string, codes ...string) bool {
|
||||||
|
for _, code := range codes {
|
||||||
|
if strings.Contains(emoj, code) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func emojiHTML(e mastodon.Emoji, height string) string {
|
func emojiHTML(e mastodon.Emoji, height string) string {
|
||||||
return `<img class="emoji" src="` + e.URL + `" alt=":` + e.ShortCode + `:" title=":` + e.ShortCode + `:" height="` + height + `"/>`
|
return `<img class="emoji" src="` + e.URL + `" alt=":` + e.ShortCode + `:" title=":` + e.ShortCode + `:" height="` + height + `"/>`
|
||||||
}
|
}
|
||||||
|
@ -142,6 +152,7 @@ func NewRenderer(templateGlobPattern string) (r *renderer, err error) {
|
||||||
t := template.New("default")
|
t := template.New("default")
|
||||||
t, err = t.Funcs(template.FuncMap{
|
t, err = t.Funcs(template.FuncMap{
|
||||||
"EmojiFilter": emojiFilter,
|
"EmojiFilter": emojiFilter,
|
||||||
|
"Allowed_emoji_page": allowed_emoji_page,
|
||||||
"StatusContentFilter": statusContentFilter,
|
"StatusContentFilter": statusContentFilter,
|
||||||
"DisplayInteractionCount": displayInteractionCount,
|
"DisplayInteractionCount": displayInteractionCount,
|
||||||
"TimeSince": timeSince,
|
"TimeSince": timeSince,
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
<div class="emoji-list-container">
|
<div class="emoji-list-container">
|
||||||
{{range .Emojis}}
|
{{range .Emojis}}
|
||||||
|
{{if Allowed_emoji_page .ShortCode "blobfox" "senko" "shiro"}}
|
||||||
<div class="emoji-item-container">
|
<div class="emoji-item-container">
|
||||||
<div class="emoji-item">
|
<div class="emoji-item">
|
||||||
<img class="emoji" src="{{.URL}}" alt="{{.ShortCode}}" height="32" loading="lazy" />
|
<img class="emoji" src="{{.URL}}" alt="{{.ShortCode}}" height="32" loading="lazy" />
|
||||||
|
@ -11,6 +12,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{template "footer.tmpl"}}
|
{{template "footer.tmpl"}}
|
||||||
|
|
Loading…
Reference in New Issue