mirror of
https://gitea.phreedom.club/localhost_frssoft/bloat.git
synced 2024-12-24 14:39:48 +00: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
|
||||
}
|
||||
|
||||
|
||||
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 {
|
||||
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, err = t.Funcs(template.FuncMap{
|
||||
"EmojiFilter": emojiFilter,
|
||||
"Allowed_emoji_page": allowed_emoji_page,
|
||||
"StatusContentFilter": statusContentFilter,
|
||||
"DisplayInteractionCount": displayInteractionCount,
|
||||
"TimeSince": timeSince,
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
<div class="emoji-list-container">
|
||||
{{range .Emojis}}
|
||||
{{if Allowed_emoji_page .ShortCode "blobfox" "senko" "shiro"}}
|
||||
<div class="emoji-item-container">
|
||||
<div class="emoji-item">
|
||||
<img class="emoji" src="{{.URL}}" alt="{{.ShortCode}}" height="32" loading="lazy" />
|
||||
@ -11,6 +12,7 @@
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
{{template "footer.tmpl"}}
|
||||
|
Loading…
Reference in New Issue
Block a user