1
0
Fork 0
mirror of https://github.com/Eggbertx/gochan.git synced 2025-08-14 16:26:23 -07:00

HEAVILY simplify template execution

This commit is contained in:
Joshua Merrell 2018-04-06 01:03:57 -07:00
parent 5745428655
commit ce303c086e
20 changed files with 395 additions and 533 deletions

View file

@ -2,31 +2,30 @@
<html>
<head>
<meta charset="UTF-8">
<title>{{$config.SiteName}}</title>
<title>{{.config.SiteName}}</title>
<script type="text/javascript" src="/javascript/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="/javascript/msgpack.js"></script>
<script type="text/javascript">
var styles = [{{range $ii, $style := $config.Styles_img}}{{if gt $ii 0}}, {{end}}"{{$style}}"{{end}}];
var webroot = "{{$config.SiteWebfolder}}"
var styles = [{{range $ii, $style := .config.Styles_img}}{{if gt $ii 0}}, {{end}}"{{$style}}"{{end}}];
var webroot = "{{.config.SiteWebfolder}}"
</script>
<script type="text/javascript" src="/javascript/gochan.js"></script>
<script type="text/javascript" src="/javascript/manage.js"></script>
<link rel="stylesheet" href="/css/global/front.css" />
{{range $i, $style := $config.Styles_img}}
<link rel="{{if isStyleNotDefault_img $style}}alternate {{end}}stylesheet" href="/css/{{$style}}/front.css" />{{end}}
{{range $i, $style := .config.Styles_img}}
<link rel="{{if not (isStyleDefault_img $style)}}alternate {{end}}stylesheet" href="/css/{{$style}}/front.css" />{{end}}
<link rel="shortcut icon" href="/favicon.png">
</head>
<body>
<div id="topbar">
{{range $i, $board := $board_arr.Data}}
{{range $i, $board := .boards}}
<a href="/{{$board.Dir}}/" class="topbar-item">/{{$board.Dir}}/</a>
{{end}}
</div>
<div id="top-pane">
<span id="site-title">{{$config.SiteName}}</span><br />
<span id="site-slogan">{{$config.SiteSlogan}}</span>
<span id="site-title">{{.config.SiteName}}</span><br />
<span id="site-slogan">{{.config.SiteSlogan}}</span>
</div>
<div id="main">
<div id="tab-bar">
@ -43,11 +42,9 @@
<a href="#faq">FAQ</a>
</div>
</div>
<div id="first-page" class="page">
{{range $ii, $page := $page_arr.Data}}
{{if intEq $page.Page 0}}
{{range $ii, $page := .page_arr}}
{{if eq $page.Page 0}}
<div class="section-block">
<div class="section-title-block" id="first-page0">
<b>{{$page.Subject}}</b> by <a href="mailto:{{$page.Email}}" >{{$page.Poster}}</a><a href="/#first-page{{$ii}}" class="permalink">#</a>
@ -59,7 +56,6 @@
{{end}}
{{end}}
</div>
<div id="boards-page" class="page">
<div class="section-block">
<div class="section-title-block">
@ -67,19 +63,16 @@
</div>
<div class="section-body">
<ul>
{{range $i, $board := $board_arr.Data}}
{{if stringEq $board.Dir $config.Modboard}}{{else}}
<li><b>/{{$board.Dir}}/</b> {{$board.Description}}</li>
{{end}}
{{end}}
{{range $_, $board := .boards}}
{{if eq $board.Dir $.config.Modboard}}{{else}}
<li><b>/{{$board.Dir}}/</b> {{$board.Description}}</li>{{end}}{{end}}
</ul>
</div>
</div>
</div>
<div id="rules-page" class="page">
{{range $ii, $page := $page_arr.Data}}
{{if intEq $page.Page 1}}
{{range $ii, $page := .page_arr}}
{{if eq $page.Page 1}}
<div class="section-block">
<div class="section-title-block" id="first-page0">
<b>{{$page.Subject}}</b> by <a href="mailto:{{$page.Email}}" >{{$page.Poster}}</a><a href="/#first-page{{$ii}}" class="permalink">#</a>
@ -91,10 +84,9 @@
{{end}}
{{end}}
</div>
<div id="faq-page" class="page">
{{range $ii, $page := $page_arr.Data}}
{{if intEq $page.Page 2}}
{{range $ii, $page := .page_arr.Data}}
{{if eq $page.Page 2}}
<div class="section-block">
<div class="section-title-block" id="first-page0">
<b>{{$page.Subject}}</b> by <a href="mailto:{{$page.Email}}" >{{$page.Poster}}</a><a href="/#first-page{{$ii}}" class="permalink">#</a>
@ -106,16 +98,16 @@
{{end}}
{{end}}
</div>
{{if gt $config.MaxRecentPosts 0}}
{{if gt .config.MaxRecentPosts 0}}
<div id="recent-posts">
<div id="recent-posts-header" class="section-title-block"><b>Recent Posts</b></div>
{{range $i, $post := $recent_posts_arr.Data}}
{{range $i, $post := $.recent_posts}}
<div class="section-block">
<div class="section-title-block">
<span class="section-title"><a href="{{$post.BoardName}}/res/{{if intEq $post.ParentID 0}}{{intToString $post.PostID}}.html{{else}}{{intToString $post.ParentID}}.html#{{intToString $post.PostID}}{{end}}">/{{$post.BoardName}}/</a></span> - {{$appended := stringAppend $post.Name $post.Tripcode}}{{if stringEq $appended ""}}<b>Anonymous</b>{{else}}<b>{{$post.Name}}</b>{{if stringNeq $post.Tripcode ""}}!{{$post.Tripcode}}{{end}}{{end}}
<span class="section-title"><a href="{{$post.BoardName}}/res/{{if eq $post.ParentID 0}}{{intToString $post.PostID}}.html{{else}}{{intToString $post.ParentID}}.html#{{intToString $post.PostID}}{{end}}">/{{$post.BoardName}}/</a></span> - {{$appended := stringAppend $post.Name $post.Tripcode}}{{if eq $appended ""}}<b>Anonymous</b>{{else}}<b>{{$post.Name}}</b>{{if ne $post.Tripcode ""}}!{{$post.Tripcode}}{{end}}{{end}}
</div>
<div class="section-body">
{{if stringNeq $post.Filename ""}}<a href="{{$post.BoardName}}/src/{{$post.Filename}}" target="_blank"><img src="{{$post.BoardName}}/thumb/{{getThumbnailFilename $post.Filename}}" alt="post thumbnail"/></a>{{end}}
{{if ne $post.Filename ""}}<a href="{{$post.BoardName}}/src/{{$post.Filename}}" target="_blank"><img src="{{$post.BoardName}}/thumb/{{getThumbnailFilename $post.Filename}}" alt="post thumbnail"/></a>{{end}}
{{truncateMessage $post.Message 225 12}}
</div>
</div>
@ -124,8 +116,8 @@
{{end}}
</div>
<div id="footer">
<a href="{{$config.SiteWebfolder}}">Home</a> | <a href="{{$config.SiteWebfolder}}#boards">Boards</a> | <a href="{{$config.SiteWebfolder}}#rules">Rules</a> | <a href="{{$config.SiteWebfolder}}#faq">FAQ</a><br />
Powered by <a href="http://github.com/eggbertx/gochan">Gochan {{$config.Version}}</a><br />
<a href="{{.config.SiteWebfolder}}">Home</a> | <a href="{{.config.SiteWebfolder}}#boards">Boards</a> | <a href="{{.config.SiteWebfolder}}#rules">Rules</a> | <a href="{{.config.SiteWebfolder}}#faq">FAQ</a><br />
Powered by <a href="http://github.com/eggbertx/gochan">Gochan {{.config.Version}}</a><br />
</div>
</body>
</html>