Add election background pattern
This commit is contained in:
BIN
res/include/img/background_patterns/checker_vote.png
Normal file
BIN
res/include/img/background_patterns/checker_vote.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 385 B |
@@ -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)
|
||||||
|
Reference in New Issue
Block a user