[help] [img] [forum]
[Catalog] · [Search] [News] [Manage]
[Return]
Posting mode: Reply
Post reply
Name
Email
Subject
Message
CAPTCHA CAPTCHA Challenge Click to refresh.
File
Password For post deletion.
Submit  
  • Helpful information is available in the visitor guide. Currently 11 unique user posts.
  • Supported file types are JPG, PNG and GIF.
  • Maximum file size allowed is 2MB.
  • Images greater than 250x250 will be thumbnailed.
  • Supported BBCode tags are b, code, i, pre, sjis, spoiler, s and u.

have the rotating banner refresh when clicked


Thanks for the suggestion. This is possible by customizing the template extra_logo.gohtml, because the template appears after the banner image. Use JavaScript to add a "click" handler to the banner img element. Use Go HTML template actions to access the list of available banners. All available banners (including ones not just configured for boards) are accessible to custom pages and custom templates via $.Opt.Banners.

The variable $.Opt.Banners is a map populated by refreshBannerCache:

https://codeberg.org/tslocum/sriracha/src/commit/f6a246019581d55f8f7aa695a48629a77eb909ca/internal/server/server.go#L1149

The following Go HTML template code demonstrates how to access the banners which are configured to show for the current board:

index $.Opt.Banners $.Board.ID

extra_logo.gohtml will be included in all pages, not just imageboard and forum pages. $.Board will not be set on such pages. So, we will need to wrap our HTML and JavaScript in a Go HTML template if block:

1
2
3
4
5
{{if ne $.Board nil}}
{{/* (Extra HTML and JavaScript here) */}}
{{$boardBanners := index $.Opt.Banners $.Board.ID}}
{{/* (Extra HTML and JavaScript using $boardBanners here) */}}
{{end}}

The template imgboard_begin.gohtml shows how the available banner images are normally accessed:

https://codeberg.org/tslocum/sriracha/src/commit/f6a246019581d55f8f7aa695a48629a77eb909ca/internal/server/template/imgboard_begin.gohtml#L91

See the following sections of the manual for more info:

- https://codeberg.org/tslocum/sriracha/src/branch/main/MANUAL.md#custom-templates
- https://codeberg.org/tslocum/sriracha/src/branch/main/MANUAL.md#custom-pages


>>88
thanks


Delete Post