Add election background pattern

This commit is contained in:
2021-03-17 13:52:49 +01:00
parent d5597f2d25
commit c848dba860
2 changed files with 10 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 B

View File

@@ -204,10 +204,19 @@ func (tm *TemplateManager) Get() *template.Template {
// Template functions. These can be called from within the template to execute // Template functions. These can be called from within the template to execute
// more specialized actions // more specialized actions
const (
electionStart = 1615935600
electionEnd = 1616022000
)
func (tm *TemplateManager) bgPattern() template.URL { func (tm *TemplateManager) bgPattern() template.URL {
var now = time.Now() var now = time.Now()
var epoch = now.Unix()
var file string var file string
if now.Weekday() == time.Wednesday && now.UnixNano()%10 == 0 {
if epoch > electionStart && epoch < electionEnd {
file = "checker_vote.png"
} else if now.Weekday() == time.Wednesday && now.UnixNano()%10 == 0 {
file = "checker_wednesday.png" file = "checker_wednesday.png"
} else { } else {
file = fmt.Sprintf("checker%d.png", now.UnixNano()%17) file = fmt.Sprintf("checker%d.png", now.UnixNano()%17)