chore: mv asset

This commit is contained in:
henry.chen
2025-07-17 10:57:44 +08:00
parent be0280ac56
commit 4abe528742
58 changed files with 19 additions and 25 deletions

View File

@@ -14,8 +14,8 @@ import (
var (
// Conf 配置
Conf Config
// WorkDir 工作目录
WorkDir string
// EtcDir 工作目录
EtcDir string
)
// Config config
@@ -50,11 +50,11 @@ func init() {
// 加载配置文件
var err error
WorkDir, err = config.WalkWorkDir()
EtcDir, err = config.WorkEtcPath()
if err != nil {
panic(err)
}
path := filepath.Join(WorkDir, "etc", "app.yml")
path := filepath.Join(EtcDir, "app.yml")
data, err := os.ReadFile(path)
if err != nil {

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

25
cmd/eiblog/etc/assets/admin/jquery.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 847 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="110px" height="26px" viewBox="0 0 110 26" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
<title>typecho-logo</title>
<description>Created with Sketch (http://www.bohemiancoding.com/sketch)</description>
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
<path d="M34.75,5.288 C34.288,6.542 33.76,7.73 32.22,7.862 L32,9.468 L33.562,9.468 L33.562,15.342 C33.562,16.882 33.54,18.994 36.972,18.994 C38.006,18.994 39.106,18.686 39.766,18.224 L39.106,16.53 C38.754,16.75 38.204,16.992 37.61,16.992 C36.708,16.992 36.18,16.596 36.18,15.254 L36.18,9.468 L38.886,9.468 L39.106,7.62 L36.18,7.62 L36.18,5.288 L34.75,5.288 Z M48.258,18.268 C48.258,20.27 47.444,21.502 45.42,21.502 C44.76,21.502 44.276,21.436 43.858,21.282 C43.462,21.128 43.352,20.908 43.352,20.49 L43.352,19.434 L41.262,19.61 L41.262,22.668 C42.186,23.13 44.012,23.394 45.398,23.394 C48.676,23.394 50.502,21.898 50.502,18.268 L50.502,7.62 L46.63,7.62 L46.63,9.424 L47.334,9.468 C47.752,9.468 47.884,9.644 47.884,10.128 L47.884,14.11 C47.884,15.254 47.07,16.288 45.53,16.288 C44.122,16.288 43.902,15.276 43.902,13.934 L43.902,7.62 L40.03,7.62 L40.03,9.424 L40.734,9.468 C41.108,9.49 41.284,9.622 41.284,10.084 L41.284,14.506 C41.284,17.102 42.494,18.312 44.694,18.312 C46.146,18.312 47.488,17.696 48.258,16.596 L48.258,18.268 Z M54,20.776 C54,21.326 53.78,21.458 53.362,21.502 L52.636,21.568 L52.636,23.24 L58.312,23.24 L58.312,21.502 L56.53,21.414 L56.53,18.378 C57.102,18.73 58.026,19.016 58.884,19.016 C61.788,19.016 63.702,16.926 63.702,12.878 C63.702,8.94 62.162,7.29 59.72,7.29 C57.85,7.29 56.64,8.302 56.244,9.05 L56.244,7.62 L52.526,7.62 L52.526,9.402 L53.45,9.468 C53.868,9.468 54,9.644 54,10.128 L54,20.776 Z M60.974,13.098 C60.974,15.012 60.336,16.926 58.466,16.926 C57.894,16.926 57.102,16.75 56.53,16.376 L56.53,11.316 C56.53,10.304 57.498,9.424 58.752,9.424 C59.918,9.424 60.974,10.172 60.974,13.098 Z M70.786,7.29 C67.178,7.29 65.352,10.15 65.352,13.406 C65.352,16.684 66.804,18.972 70.544,18.972 C72.612,18.972 74.064,18.048 74.416,17.74 L73.58,15.958 C73.052,16.332 72.106,16.926 70.808,16.926 C68.938,16.926 68.19,15.76 68.102,14.33 C70.698,14.308 74.372,13.736 74.372,10.348 C74.372,8.39 72.942,7.29 70.786,7.29 Z M71.952,10.392 C71.952,12.086 69.642,12.46 68.014,12.482 C68.08,10.854 68.872,9.16 70.632,9.16 C71.424,9.16 71.952,9.578 71.952,10.392 Z M81.192,16.97 C79.234,16.97 78.354,15.43 78.354,13.032 C78.354,10.59 79.256,9.27 81.016,9.27 C81.346,9.27 81.61,9.314 81.874,9.402 C82.27,9.534 82.336,9.732 82.336,10.15 L82.336,11.206 L84.36,11.052 L84.36,8.192 C83.304,7.62 82.248,7.29 80.928,7.29 C78.442,7.29 75.692,8.83 75.692,13.296 C75.692,16.948 77.606,18.994 80.84,18.994 C82.468,18.994 83.81,18.422 84.668,17.718 L83.722,16.024 C82.82,16.684 82.05,16.97 81.192,16.97 Z M87.286,16.222 C87.286,16.772 87.066,16.904 86.648,16.948 L85.922,17.014 L85.922,18.686 L91.158,18.686 L91.158,16.926 L89.904,16.86 L89.904,11.536 C89.904,10.392 90.718,9.314 92.258,9.314 C93.666,9.314 93.974,10.348 93.974,11.69 L93.974,16.222 C93.974,16.772 93.754,16.904 93.336,16.948 L92.61,17.014 L92.61,18.686 L97.846,18.686 L97.846,16.926 L96.592,16.86 L96.592,11.118 C96.592,8.522 95.294,7.29 93.094,7.29 C91.642,7.29 90.542,7.972 89.882,8.918 L89.882,3 L85.966,3 L85.966,4.826 L86.736,4.87 C87.154,4.892 87.286,5.024 87.286,5.508 L87.286,16.222 Z M98.924,13.142 C98.924,17.124 100.86,19.016 103.808,19.016 C106.712,19.016 109.066,17.08 109.066,12.856 C109.066,7.796 105.788,7.29 104.16,7.29 C101.894,7.29 98.924,8.566 98.924,13.142 Z M103.984,17.08 C101.872,17.08 101.586,14.88 101.586,12.834 C101.586,10.722 102.29,9.226 104.028,9.226 C105.788,9.226 106.382,10.744 106.382,13.208 C106.382,15.496 105.7,17.08 103.984,17.08 Z" id="typecho" fill="#000000" sketch:type="MSShapeGroup"></path>
<path d="M13,26 C3.36833333,26 0,22.631 0,13 C0,3.36866667 3.36833333,0 13,0 C22.6316667,0 26,3.36866667 26,13 C26,22.631 22.6316667,26 13,26 Z M6,9 L20,9 L20,7 L6,7 L6,9 Z M6,14 L16,14 L16,12 L6,12 L6,14 Z M6,19 L18,19 L18,17 L6,17 L6,19 Z" id="icon" fill="#000000" sketch:type="MSShapeGroup"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@@ -0,0 +1,4 @@
<?xml version="1.0"?>
<cross-domain-policy>
<allow-access-from domain="*.{{.Host}}" />
</cross-domain-policy>

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{.Title}}</title>
<link>https://{{.Host}}</link>
<description>{{.SubTitle}}</description>
<atom:link href="https://{{.Host}}/rss.html" rel="self" />
<atom:link href="{{.FeedrURL}}" rel="hub" />
<language>zh-CN</language>
<lastBuildDate>{{.BuildDate}}</lastBuildDate>
{{range .Articles}}
<item>
<title>{{.Title}}</title>
<link>https://{{$.Host}}/post/{{.Slug}}.html</link>
<comments>https://{{$.Host}}/post/{{.Slug}}.html#comments</comments>
<guid>https://{{$.Host}}/post/{{.Slug}}.html</guid>
<description>
<![CDATA[{{imgtonormal .Content}}<p>本文链接:<a href="https://{{$.Host}}/post/{{.Slug}}.html">https://{{$.Host}}/post/{{.Slug}}.html</a><a href="https://{{$.Host}}/post/{{.Slug}}.html#comments">参与评论 »</a></p>]]>
</description>
<pubDate>{{dateformat .CreatedAt "Mon, 02 Jan 2006 15:04:05 -0700"}}</pubDate>
</item>
{{end}}
</channel>
</rss>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>{{.BTitle}}</ShortName>
<Description>{{.SubTitle}}</Description>
<InputEncoding>UTF-8</InputEncoding>
<Url type="text/html" method="get" template="https://{{.Host}}/search.html?q={searchTerms}" />
<moz:SearchForm>https://{{.Host}}/search.html</moz:SearchForm>
</OpenSearchDescription>

View File

@@ -0,0 +1,3 @@
User-agent: *
Allow: /
Sitemap: https://{{.Host}}/sitemap.xml

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{{range .Articles}}
<url>
<loc>https://{{$.Host}}/post/{{.Slug}}.html</loc>
<lastmod>{{dateformat .CreatedAt "2006-01-02"}}</lastmod>
<priority>0.6</priority>
</url>
{{end}}
</urlset>

View File

@@ -0,0 +1 @@
{{define "notfound"}}<div id=content class=inner><article class="post post-404"><h1 class=title>404 - 什么也没有</h1><div class="entry-content"><p>你要找的东东不存在喔!</p><p>请检查 URL 拼写是否有误,或者通过<a href="/search.html"> 站内搜索 </a>搜一下吧~</p></div></article></div>{{end}}

View File

@@ -0,0 +1 @@
This is the place to put your project's website data if you are not using GitHub pages.

View File

@@ -0,0 +1 @@
{{define "about"}}<div id=content class=inner>{{with .Article}}<article class="post post-{{.ID}}" itemscope itemtype="http://schema.org/Article"><h1 class=title itemprop=headline>{{.Title}}</h1><div class="entry-content" itemprop=articleBody>{{str2html .Header}}{{str2html .Content}}</div></article><section id=comments><h1 class=title>Comments</h1><div class=total_thread data-identifier="post-{{.Slug}}" data-url="https://{{$.Domain}}/post/{{.Slug}}.html"></div></section>{{end}}</div>{{end}}

View File

@@ -0,0 +1,162 @@
<!DOCTYPE HTML>
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
<meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{.Title}}</title>
<meta name="robots" content="noindex, nofollow">
<link rel="stylesheet" href="/static/admin/style.css">
<!--[if lt IE 9]>
<script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!--[if lt IE 9]>
<div class="alert alert-danger topframe" role="alert">你的浏览器实在<strong>太太太太太太旧了</strong>,放学别走,升级完浏览器再说 <a target="_blank" class="alert-link" href="http://browsehappy.com">立即升级</a></div>
<![endif]-->
<script src="/static/admin/jquery.js"></script>
<script src="/static/admin/jquery-ui.js"></script>
<script src="/static/admin/typecho.js"></script>
<div class="typecho-head-nav clearfix" role="navigation">
<nav id="typecho-nav-list">
<ul class="root {{if .Console}}focus{{end}}">
<li class="parent"><a target="_self" href="/admin/profile">控制台</a></dt>
</li>
<ul class="child">
<li {{if eq .Path "/admin/profile"}}class="focus" {{end}}><a target="_self" href="/admin/profile">个人设置</a></li>
</ul>
</ul>
<ul class="root {{if .Post}}focus{{end}}">
<li class="parent"><a target="_self" href="/admin/write-post">撰写</a></dt>
</li>
<ul class="child">
<li class="last {{if eq .Path "/admin/write-post"}}focus{{end}}"><a target="_self" href="/admin/write-post">撰写文章</a></li>
</ul>
</ul>
<ul class="root {{if .Manage}}focus{{end}}">
<li class="parent"><a target="_self" href="/admin/manage-posts">管理</a></dt>
</li>
<ul class="child">
<li {{if eq .Path "/admin/manage-posts"}}class="focus" {{end}}><a target="_self" href="/admin/manage-posts">文章</a></li>
<li {{if eq .Path "/admin/manage-series"}}class="focus" {{end}}><a target="_self" href="/admin/manage-series">专题</a></li>
{{if eq .Path "/admin/add-serie"}}<li class="focus"><a target="_self" href="/admin/add-serie">{{if .Edit}}编辑专题{{else}}新增专题{{end}}</a></li>{{end}}
<li class="last {{if eq .Path "/admin/manage-tags"}}focus{{end}}"><a target="_self" href="/admin/manage-tags">标签</a></li>
<li class="last {{if eq .Path "/admin/manage-draft"}}focus{{end}}"><a target="_self" href="/admin/manage-draft">草稿箱</a></li>
<li class="last {{if eq .Path "/admin/manage-trash"}}focus{{end}}"><a target="_self" href="/admin/manage-trash">回收箱</a></li>
</ul>
</ul>
<ul class="root {{if .Setting}}focus{{end}}">
<li class="parent"><a target="_self" href="/admin/options-general">设置</a></dt>
</li>
<ul class="child">
<li {{if eq .Path "/admin/options-general"}}class="focus" {{end}}><a target="_self" href="/admin/options-general">基本</a></li>
<li class="last {{if eq .Path "/admin/options-discussion"}}focus{{end}}"><a target="_self" href="/admin/options-discussion">阅读</a></li>
</ul>
</ul>
</nav>
<div class="operate">
<a target="_self" title="{{.LastLogin}}" href="/admin/profile" class="author">{{.Author}}</a><a class="exit" href="/admin/login?logout=true">登出</a><a target="_blank" href="/">网站</a>
</div>
</div>
<div class="main">
{{.LayoutContent}}
</div>
<div class="typecho-foot" role="contentinfo">
<div class="copyright">
<a href="http://typecho.org" class="i-logo-s">Typecho</a>
<p><a href="http://typecho.org">Typecho</a> 提供皮肤, 版本 1.0 (14.10.10)</p>
</div>
</div>
<script>
(function () {
$(document).ready(function() {
// 处理消息机制
(function () {
cookies = {
notice : $.cookie( 'notice'),
noticeType : $.cookie( 'notice_type'),
highlight : $.cookie('notice_highlight')
},
path = '/';
if (!!cookies.notice && 'success|notice|error'.indexOf(cookies.noticeType) >= 0) {
var head = $('.typecho-head-nav'),
p = $('<div class="message popup ' + cookies.noticeType + '">'
+ '<ul><li>' + $.parseJSON(cookies.notice).join('</li><li>')
+ '</li></ul></div>'), offset = 0;
if (head.length > 0) {
p.insertAfter(head);
offset = head.outerHeight();
} else {
p.prependTo(document.body);
}
function checkScroll () {
if ($(window).scrollTop() >= offset) {
p.css({
'position' : 'fixed',
'top' : 0
});
} else {
p.css({
'position' : 'absolute',
'top' : offset
});
}
}
$(window).scroll(function () {
checkScroll();
});
checkScroll();
p.slideDown(function () {
var t = $(this), color = '#C6D880';
if (t.hasClass('error')) {
color = '#FBC2C4';
} else if (t.hasClass('notice')) {
color = '#FFD324';
}
t.effect('highlight', {color : color})
.delay(5000).slideUp(function () {
$(this).remove();
});
});
$.cookie('notice', null, {path : path});
$.cookie('notice_type', null, {path : path});
}
if (cookies.highlight) {
$('#' + cookies.highlight).effect('highlight', 1000);
$.cookie('notice_highlight', null, {path : path});
}
})();
// 导航菜单 tab 聚焦时展开下拉菜单
(function () {
$('#typecho-nav-list').find('.parent a').focus(function() {
$('#typecho-nav-list').find('.child').hide();
$(this).parents('.root').find('.child').show();
});
$('.operate').find('a').focus(function() {
$('#typecho-nav-list').find('.child').hide();
});
})();
});
})();
</script>
</body>
</html>

View File

@@ -0,0 +1,3 @@
{{define "admin-discussion"}}
{{end}}

View File

@@ -0,0 +1,81 @@
{{define "admin-draft"}}
<div class="body container">
<div class="typecho-page-title">
<h2>草稿箱</h2>
</div>
<div class="row typecho-page-main manage-metas">
<div class="col-mb-12" role="main">
<form method="post" name="manage_draft" class="operate-form">
<div class="typecho-list-operate clearfix">
<div class="operate">
<label><i class="sr-only">全选</i>
<input type="checkbox" class="typecho-table-select-all" />
</label>
<div class="btn-group btn-drop">
<button class="btn dropdown-toggle btn-s" type="button"><i class="sr-only">操作</i>选中项 <i class="i-caret-down"></i></button>
<ul class="dropdown-menu">
<li><a lang="此草稿箱下的所有内容将被永久删除, 你确认要删除这些文章吗?" href="/admin/api/draft-delete">删除</a></li>
</ul>
</div>
</div>
<div class="search" role="search">
</div>
</div>
<div class="typecho-table-wrap">
<table class="typecho-list-table">
<colgroup>
<col width="20" />
<col width="40%" />
<col width="" />
<col width="12%" />
<col width="14%" />
<col width="14%" />
</colgroup>
<thead>
<tr>
<th> </th>
<th>标题</th>
<th>作者</th>
<th>专题</th>
<th>创建</th>
<th>保存</th>
</tr>
</thead>
<tbody>
{{range .List}}
<tr id="mid-article-{{.ID}}">
<td>
<input type="checkbox" value="{{.ID}}" name="mid[]" />
</td>
<td><a href="/admin/write-post?cid={{.ID}}">{{.Title}}</a></td>
<td>{{.Author}}</td>
<td>{{if gt .SerieID 0}}专题ID:{{.SerieID}}{{else}}--{{end}}</td>
<td>{{dateformat .CreatedAt "2006/01/02 15:04"}}</td>
<td>{{dateformat .UpdatedAt "2006/01/02 15:04"}}</td>
</tr>
{{end}}
</tbody>
</table>
</div>
</form>
</div>
</div>
</div>
<script>
(function() {
$(document).ready(function() {
$('.typecho-list-table').tableSelectable({
checkEl: 'input[type=checkbox]',
rowEl: 'tr',
selectAllEl: '.typecho-table-select-all',
actionEl: '.dropdown-menu a,button.btn-operate'
});
$('.btn-drop').dropdownMenu({
btnEl: '.dropdown-toggle',
menuEl: '.dropdown-menu'
});
});
})();
</script>
{{end}}

View File

@@ -0,0 +1,3 @@
{{define "admin-general"}}
{{end}}

View File

@@ -0,0 +1,38 @@
<!Doctype html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<meta content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" name=viewport>
<meta name=robots content="noindex, nofollow">
<title>登录 | {{.BTitle}}</title>
<link rel=stylesheet href="/static/admin/style.css">
</head>
<body class="body-100">
<div class="typecho-login-wrap">
<div class="typecho-login">
<h1><a href="/">{{.BTitle}}</a></h1>
<form action="/admin/login" method=post>
<p>
<label for=user class="sr-only">用户名</label>
<input type=text id=user name=user placeholder="用户名" class="text-l w-100">
</p>
<p>
<label for=password class="sr-only">密码</label>
<input type=password id=password name=password class="text-l w-100" placeholder="密码">
</p>
<!-- <p>
<label for=code class="sr-only">两步验证</label>
<input type=text id=code name=code class="text-l w-100" placeholder="两步验证">
</p> -->
<p class=submit>
<button type=submit class="btn btn-l w-100 primary">登录</button>
</p>
</form>
<p class="more-link">管理后台皮肤来自于<a href="http://typecho.org" target=_blank>Typecho</a>.</p>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,846 @@
{{define "admin-post"}}
<div class="body container">
<div class="typecho-page-title">
{{if .Edit}}<h2>编辑 {{.Edit.Title}}</h2>{{else}}<h2>撰写文章</h2>{{end}}
</div>
<div class="row typecho-page-main typecho-post-area" role="form">
<form action="/admin/api/post-add" method="post" name="write_post">
<div class="col-mb-12 col-tb-9" role="main">
{{if .Edit.IsDraft}}<cite class="edit-draft-notice">你正在编辑的是草稿, 你也可以 <a href="/admin/draft-delete?cid={{.Edit.ID}}">删除它</a></cite>{{end}}
<p class="title">
<label for="title" class="sr-only">标题</label>
<input type="text" id="title" name="title" autocomplete="off" {{with .Edit}}value="{{.Title}}"{{end}} placeholder="标题" class="w-100 text title" />
</p>
<p class="mono url-slug">
<label for="slug" class="sr-only">网址缩略名</label>
https://{{.Domain}}/post/<input type="text" id="slug" name="slug" autocomplete="off" {{with .Edit}}value="{{.Slug}}" {{end}} class="mono" />.html </p>
<p>
<label for="text" class="sr-only">文章内容</label>
<textarea style="height: 350px" autocomplete="off" id="text" name="text" class="w-100 mono">{{with .Edit}}{{.Content}}{{end}}</textarea>
</p>
<p class="submit clearfix">
<span class="right">
<input type="hidden" name="cid" {{with .Edit}}value="{{.ID}}"{{end}} />
<button type="submit" name="do" value="save" id="btn-save" class="btn">保存草稿</button>
<button type="submit" name="do" value="publish" class="btn primary" id="btn-submit">发布文章</button>
</span>
</p>
</div>
<div id="edit-secondary" class="col-mb-12 col-tb-3" role="complementary">
<ul class="typecho-option-tabs clearfix">
<li class="active w-50"><a href="#tab-advance">选项</a></li>
<li class="w-50"><a href="#tab-files" id="tab-files-btn">上传</a></li>
</ul>
<div id="tab-advance" class="tab-content">
<section class="typecho-post-option" role="application">
<label for="date" class="typecho-label">发布日期</label>
<p>
<input class="typecho-date w-100" type="text" name="date" id="date" {{with .Edit}}value="{{dateformat .CreatedAt "2006-01-02 15:04"}}"{{end}} />
</p>
</section>
<section class="typecho-post-option category-option">
<label class="typecho-label">专题</label>
<ul>
<li>
<input type="radio" id="serie-0" value="0" name="serie" checked="true"/>
<label for="serie-0">默认专题</label>
</li>
{{range $k,$v:=.Series}}
<li>
<input type="radio" id="serie-{{$v.ID}}" value="{{$v.ID}}" name="serie" {{with $.Edit}}{{if eq .SerieID $v.ID}}checked="true"{{end}}{{end}}/>
<label for="serie-{{$v.ID}}">{{$v.Name}}</label>
</li>
{{end}}
</ul>
</section>
<section class="typecho-post-option">
<label for="token-input-tags" class="typecho-label">标签</label>
<p>
<input id="tags" name="tags" type="text" {{with .Edit}}value="{{join .Tags ","}}"{{end}} class="w-100 text" />
</p>
</section>
<section class="typecho-post-option category-option">
<label class="typecho-label">其它选项</label>
<ul>
<li>
<input type="checkbox" id="update" value="true" name="update" />
<label for="update">变动很大(更新时间)?</label>
</li>
</ul>
</section>
</div>
<!-- end #tab-advance -->
<div id="tab-files" class="tab-content hidden">
<div id="upload-panel" class="p">
<div class="upload-area" draggable="true">拖放文件到这里
<br>或者 <a href="###" class="upload-file">选择文件上传</a></div>
<ul id="file-list">
</ul>
</div>
</div>
<!-- end #tab-files -->
</div>
</form>
</div>
</div>
<script>
(function() {
$(document).ready(function() {
var error = $('.typecho-option .error:first');
if (error.length > 0) {
$('html,body').scrollTop(error.parents('.typecho-option').offset().top);
}
$('form').submit(function() {
if (this.submitted) {
return false;
} else {
this.submitted = true;
}
});
$('label input[type=text]').click(function(e) {
var check = $('#' + $(this).parents('label').attr('for'));
check.prop('checked', true);
return false;
});
});
})();
</script>
<script src="/static/admin/timepicker.js"></script>
<script src="/static/admin/tokeninput.js"></script>
<script>
$(document).ready(function() {
// 日期时间控件
$('#date').mask('9999-99-99 99:99').datetimepicker({
currentText: '现在',
prevText: '上一月',
nextText: '下一月',
monthNames: ['一月', '二月', '三月', '四月',
'五月', '六月', '七月', '八月',
'九月', '十月', '十一月', '十二月'
],
dayNames: ['星期日', '星期一', '星期二',
'星期三', '星期四', '星期五', '星期六'
],
dayNamesShort: ['周日', '周一', '周二', '周三',
'周四', '周五', '周六'
],
dayNamesMin: ['日', '一', '二', '三',
'四', '五', '六'
],
closeText: '完成',
timeOnlyTitle: '选择时间',
timeText: '时间',
hourText: '时',
amNames: ['上午', 'A'],
pmNames: ['下午', 'P'],
minuteText: '分',
secondText: '秒',
dateFormat: 'yy-mm-dd',
hour: (new Date()).getHours(),
minute: (new Date()).getMinutes()
});
// 聚焦
$('#title').select();
// tag autocomplete 提示
var tags = $('#tags'),
tagsPre = [];
if (tags.length > 0) {
var items = tags.val().split(','),
result = [];
for (var i = 0; i < items.length; i++) {
var tag = items[i];
if (!tag) {
continue;
}
tagsPre.push({
id: tag,
tags: tag
});
}
tags.tokenInput({{.Tags}}, {
propertyToSearch: 'tags',
tokenValue: 'tags',
searchDelay: 0,
preventDuplicates: true,
animateDropdown: false,
hintText: '请输入标签名',
noResultsText: '此标签不存在, 按回车创建',
prePopulate: tagsPre,
onResult: function(result, query) {
if (!query) {
return result;
}
if (!result) {
result = [];
}
if (!result[0] || result[0]['id'] != query) {
result.unshift({
id: query,
tags: query
});
}
return result.slice(0, 5);
}
});
// tag autocomplete 提示宽度设置
$('#token-input-tags').focus(function() {
var t = $('.token-input-dropdown'),
offset = t.outerWidth() - t.width();
t.width($('.token-input-list').outerWidth() - offset);
});
}
// 缩略名自适应宽度
var slug = $('#slug');
if (slug.length > 0) {
var wrap = $('<div />').css({
'position': 'relative',
'display': 'inline-block'
}),
justifySlug = $('<pre />').css({
'display': 'block',
'visibility': 'hidden',
'height': slug.height(),
'padding': '0 2px',
'margin': 0
}).insertAfter(slug.wrap(wrap).css({
'left': 0,
'top': 0,
'minWidth': '5px',
'position': 'absolute',
'width': '100%'
})),
originalWidth = slug.width();
function justifySlugWidth() {
var val = slug.val();
justifySlug.text(val.length > 0 ? val : ' ');
}
slug.bind('input propertychange', justifySlugWidth);
justifySlugWidth();
}
// 原始的插入图片和文件
Typecho.insertFileToEditor = function(file, url, isImage) {
var textarea = $('#text'),
sel = textarea.getSelection(),
html = isImage ? '<img src="' + url + '" alt="' + file + '" />' : '<a href="' + url + '">' + file + '</a>',
offset = (sel ? sel.start : 0) + html.length;
textarea.replaceSelection(html);
textarea.setSelection(offset, offset);
};
var submitted = false,
form = $('form[name=write_post],form[name=write_page]').submit(function() {
submitted = true;
}),
savedData = null;
// 自动保存
var locked = false,
formAction = form.attr('action'),
idInput = $('input[name=cid]'),
cid = idInput.val(),
autoSave = $('<span id="auto-save-message" class="left"></span>').prependTo('.submit'),
autoSaveOnce = !!cid,
lastSaveTime = null;
function autoSaveListener() {
setInterval(function() {
var data = form.serialize();
if (savedData != data && !locked) {
locked = true;
autoSave.text('正在保存');
$.post(formAction, data + '&do=auto', function(o) {
savedData = data;
lastSaveTime = o.time;
idInput.val(o.cid);
autoSave.text('已保存' + ' (' + o.time + ')').effect('highlight', 1000);
locked = false;
}, 'json');
}
}, 20000);
}
if (autoSaveOnce) {
savedData = form.serialize();
autoSaveListener();
}
$('#text').bind('input propertychange', function() {
if (!locked) {
autoSave.text('尚未保存' + (lastSaveTime ? ' (上次保存时间: ' + lastSaveTime + ')' : ''));
}
if (!autoSaveOnce) {
autoSaveOnce = true;
autoSaveListener();
}
});
// 自动检测离开页
var lastData = form.serialize();
$(window).bind('beforeunload', function() {
if (!!savedData) {
lastData = savedData;
}
if (form.serialize() != lastData && !submitted) {
return '内容已经改变尚未保存, 您确认要离开此页面吗?';
}
});
// 控制选项和附件的切换
var fileUploadInit = false;
$('#edit-secondary .typecho-option-tabs li').click(function() {
$('#edit-secondary .typecho-option-tabs li').removeClass('active');
$(this).addClass('active');
$('.tab-content').addClass('hidden');
var selected_tab = $(this).find('a').attr('href'),
selected_el = $(selected_tab).removeClass('hidden');
if (!fileUploadInit) {
selected_el.trigger('init');
fileUploadInit = true;
}
return false;
});
// 自动隐藏密码框
$('#visibility').change(function() {
var val = $(this).val(),
password = $('#post-password');
if ('password' == val) {
password.removeClass('hidden');
} else {
password.addClass('hidden');
}
});
// 草稿删除确认
$('.edit-draft-notice a').click(function () {
if (confirm('您确认要删除这份草稿吗?')) {
window.location.href = $(this).attr('href');
}
return false;
});
});
</script>
<script src="/static/admin/hyperdown.js"></script>
<script src="/static/admin/pagedown.js"></script>
<script src="/static/admin/pagedown-extra.js"></script>
<script src="/static/admin/diff.js"></script>
<script>
$(document).ready(function() {
var textarea = $('#text'),
toolbar = $('<div class="editor" id="wmd-button-bar" />').insertBefore(textarea.parent()),
preview = $('<div id="wmd-preview" class="wmd-hidetab" />').insertAfter('.editor');
var options = {},
isMarkdown = 1;
options.strings = {
bold: '加粗 <strong> Ctrl+B',
boldexample: '加粗文字',
italic: '斜体 <em> Ctrl+I',
italicexample: '斜体文字',
link: '链接 <a> Ctrl+L',
linkdescription: '请输入链接描述',
quote: '引用 <blockquote> Ctrl+Q',
quoteexample: '引用文字',
code: '代码 <pre><code> Ctrl+K',
codeexample: '请输入代码',
image: '图片 <img> Ctrl+G',
imagedescription: '请输入图片描述',
olist: '数字列表 <ol> Ctrl+O',
ulist: '普通列表 <ul> Ctrl+U',
litem: '列表项目',
heading: '标题 <h1>/<h2> Ctrl+H',
headingexample: '标题文字',
hr: '分割线 <hr> Ctrl+R',
more: '摘要分割线 <!--more--> Ctrl+M',
undo: '撤销 - Ctrl+Z',
redo: '重做 - Ctrl+Y',
redomac: '重做 - Ctrl+Shift+Z',
fullscreen: '全屏 - Ctrl+J',
exitFullscreen: '退出全屏 - Ctrl+E',
fullscreenUnsupport: '此浏览器不支持全屏操作',
imagedialog: '<p><b>插入图片</b></p><p>请在下方的输入框内输入要插入的远程图片地址</p><p>您也可以使用附件功能插入上传的本地图片</p>',
linkdialog: '<p><b>插入链接</b></p><p>请在下方的输入框内输入要插入的链接地址</p>',
ok: '确定',
cancel: '取消',
help: 'Markdown语法帮助'
};
var converter = new HyperDown(),
editor = new Markdown.Editor(converter, '', options),
diffMatch = new diff_match_patch(), last = '', preview = $('#wmd-preview'),
mark = '@mark' + Math.ceil(Math.random() * 100000000) + '@',
span = '<span class="diff" />',
cache = {};
// 自动跟随
converter.hook('makeHtml', function (html) {
// convert all comment
html = html.replace(/&lt;!--(.+?)--&gt;/g, '<!--$1-->');
if (html.indexOf('<!--more-->') > 0) {
var parts = html.split(/\s*<\!\-\-more\-\->\s*/),
summary = parts.shift(),
details = parts.join('');
html = '<div class="summary">' + summary + '</div>'
+ '<div class="details">' + details + '</div>';
}
var diffs = diffMatch.diff_main(last, html);
last = html;
if (diffs.length > 0) {
var stack = [], markStr = mark;
for (var i = 0; i < diffs.length; i ++) {
var diff = diffs[i], op = diff[0], str = diff[1]
sp = str.lastIndexOf('<'), ep = str.lastIndexOf('>');
if (op != 0) {
if (sp >=0 && sp > ep) {
if (op > 0) {
stack.push(str.substring(0, sp) + markStr + str.substring(sp));
} else {
var lastStr = stack[stack.length - 1], lastSp = lastStr.lastIndexOf('<');
stack[stack.length - 1] = lastStr.substring(0, lastSp) + markStr + lastStr.substring(lastSp);
}
} else {
if (op > 0) {
stack.push(str + markStr);
} else {
stack.push(markStr);
}
}
markStr = '';
} else {
stack.push(str);
}
}
html = stack.join('');
if (!markStr) {
var pos = html.indexOf(mark), prev = html.substring(0, pos),
next = html.substr(pos + mark.length),
sp = prev.lastIndexOf('<'), ep = prev.lastIndexOf('>');
if (sp >= 0 && sp > ep) {
html = prev.substring(0, sp) + span + prev.substring(sp) + next;
} else {
html = prev + span + next;
}
}
}
// 替换img
html = html.replace(/<(img)\s+([^>]*)\s*src="([^"]+)"([^>]*)>/ig, function (all, tag, prefix, src, suffix) {
if (!cache[src]) {
cache[src] = false;
} else {
return '<span class="cache" data-width="' + cache[src][0] + '" data-height="' + cache[src][1] + '" '
+ 'style="background:url(' + src + ') no-repeat left top; width:'
+ cache[src][0] + 'px; height:' + cache[src][1] + 'px; display: inline-block; max-width: 100%;'
+ '-webkit-background-size: contain;-moz-background-size: contain;-o-background-size: contain;background-size: contain;" />';
}
return all;
});
// 替换block
html = html.replace(/<(iframe|embed)\s+([^>]*)>/ig, function (all, tag, src) {
if (src[src.length - 1] == '/') {
src = src.substring(0, src.length - 1);
}
return '<div style="background: #ddd; height: 40px; overflow: hidden; line-height: 40px; text-align: center; font-size: 12px; color: #777">'
+ tag + ' : ' + $.trim(src) + '</div>';
});
return html;
});
function cacheResize() {
var t = $(this), w = parseInt(t.data('width')), h = parseInt(t.data('height')),
ow = t.width();
t.height(h * ow / w);
}
var to;
editor.hooks.chain('onPreviewRefresh', function () {
var diff = $('.diff', preview), scrolled = false;
if (to) {
clearTimeout(to);
}
$('img', preview).load(function () {
var t = $(this), src = t.attr('src');
if (scrolled) {
preview.scrollTo(diff, {
offset : - 50
});
}
if (!!src && !cache[src]) {
cache[src] = [this.width, this.height];
}
});
$('.cache', preview).resize(cacheResize).each(cacheResize);
var changed = $('.diff', preview).parent();
if (!changed.is(preview)) {
changed.css('background-color', 'rgba(255,230,0,0.5)');
to = setTimeout(function () {
changed.css('background-color', 'transparent');
}, 4500);
}
if (diff.length > 0) {
var p = diff.position(), lh = diff.parent().css('line-height');
lh = !!lh ? parseInt(lh) : 0;
if (p.top < 0 || p.top > preview.height() - lh) {
preview.scrollTo(diff, {
offset : - 50
});
scrolled = true;
}
}
});
var input = $('#text'), th = textarea.height(), ph = preview.height(),
uploadBtn = $('<button type="button" id="btn-fullscreen-upload" class="btn btn-link">'
+ '<i class="i-upload">附件</i></button>')
.prependTo('.submit .right')
.click(function() {
$('a', $('.typecho-option-tabs li').not('.active')).trigger('click');
return false;
});
$('.typecho-option-tabs li').click(function () {
uploadBtn.find('i').toggleClass('i-upload-active',
$('#tab-files-btn', this).length > 0);
});
editor.hooks.chain('enterFakeFullScreen', function () {
th = textarea.height();
ph = preview.height();
$(document.body).addClass('fullscreen');
var h = $(window).height() - toolbar.outerHeight();
textarea.css('height', h);
preview.css('height', h);
});
editor.hooks.chain('enterFullScreen', function () {
$(document.body).addClass('fullscreen');
var h = window.screen.height - toolbar.outerHeight();
textarea.css('height', h);
preview.css('height', h);
});
editor.hooks.chain('exitFullScreen', function () {
$(document.body).removeClass('fullscreen');
textarea.height(th);
preview.height(ph);
});
function initMarkdown() {
editor.run();
var imageButton = $('#wmd-image-button'),
linkButton = $('#wmd-link-button');
Typecho.insertFileToEditor = function (file, url, isImage) {
var button = isImage ? imageButton : linkButton;
options.strings[isImage ? 'imagename' : 'linkname'] = file;
button.trigger('click');
var checkDialog = setInterval(function () {
if ($('.wmd-prompt-dialog').length > 0) {
$('.wmd-prompt-dialog input').val(url).select();
clearInterval(checkDialog);
checkDialog = null;
}
}, 10);
};
Typecho.uploadComplete = function (file) {
Typecho.insertFileToEditor(file.title, file.url, file.isImage);
};
// 编辑预览切换
var edittab = $('.editor').prepend('<div class="wmd-edittab"><a href="#wmd-editarea" class="active">撰写</a><a href="#wmd-preview">预览</a></div>'),
editarea = $(textarea.parent()).attr("id", "wmd-editarea");
$(".wmd-edittab a").click(function() {
$(".wmd-edittab a").removeClass('active');
$(this).addClass("active");
$("#wmd-editarea, #wmd-preview").addClass("wmd-hidetab");
var selected_tab = $(this).attr("href"),
selected_el = $(selected_tab).removeClass("wmd-hidetab");
// 预览时隐藏编辑器按钮
if (selected_tab == "#wmd-preview") {
$("#wmd-button-row").addClass("wmd-visualhide");
} else {
$("#wmd-button-row").removeClass("wmd-visualhide");
}
// 预览和编辑窗口高度一致
$("#wmd-preview").outerHeight($("#wmd-editarea").innerHeight());
return false;
});
}
initMarkdown();
});
</script>
<script src="/static/admin/moxie.js"></script>
<script src="/static/admin/plupload.js"></script>
<script>
$(document).ready(function() {
function updateAttacmentNumber () {
var btn = $('#tab-files-btn'),
balloon = $('.balloon', btn),
count = $('#file-list li .insert').length;
if (count > 0) {
if (!balloon.length) {
btn.html($.trim(btn.html()) + ' ');
balloon = $('<span class="balloon"></span>').appendTo(btn);
}
balloon.html(count);
} else if (0 == count && balloon.length > 0) {
balloon.remove();
}
}
$('.upload-area').bind({
dragenter : function () {
$(this).parent().addClass('drag');
},
dragover : function (e) {
$(this).parent().addClass('drag');
},
drop : function () {
$(this).parent().removeClass('drag');
},
dragend : function () {
$(this).parent().removeClass('drag');
},
dragleave : function () {
$(this).parent().removeClass('drag');
}
});
updateAttacmentNumber();
function fileUploadStart (file) {
$('<li id="' + file.id + '" class="loading">'
+ file.name + '</li>').appendTo('#file-list');
}
function fileUploadError (error) {
var file = error.file, code = error.code, word;
switch (code) {
case plupload.FILE_SIZE_ERROR:
word = '文件大小超过限制';
break;
case plupload.FILE_EXTENSION_ERROR:
word = '文件扩展名不被支持';
break;
case plupload.FILE_DUPLICATE_ERROR:
word = '文件已经上传过';
break;
case plupload.HTTP_ERROR:
default:
word = '上传出现错误';
break;
}
var fileError = '%s 上传失败'.replace('%s', file.name),
li, exist = $('#' + file.id);
if (exist.length > 0) {
li = exist.removeClass('loading').html(fileError);
} else {
li = $('<li>' + fileError + '<br />' + word + '</li>').appendTo('#file-list');
}
li.effect('highlight', {color : '#FBC2C4'}, 2000, function () {
$(this).remove();
});
// fix issue #341
this.removeFile(file);
}
var completeFile = null;
function fileUploadComplete (id, data) {
var li = $('#' + id).removeClass('loading').data('title', data.title)
.data('url', data.url)
.data('image', data.isImage)
.html('<input type="hidden" name="attachment[]" value="' + data.title + '" />'
+ '<a class="insert" target="_blank" href="###" title="点击插入文件">' + data.title + '</a><div class="info">' + data.bytes
+ ' <a class="file" target="_blank" href="'
+ data.url + '" title="查看"><i class="i-edit"></i></a>'
+ ' <a class="delete" href="###" title="删除"><i class="i-delete"></i></a></div>')
.effect('highlight', 1000);
attachInsertEvent(li);
attachDeleteEvent(li);
updateAttacmentNumber();
if (!completeFile) {
completeFile = data;
}
}
$('#tab-files').bind('init', function () {
var uploader = new plupload.Uploader({
browse_button : $('.upload-file').get(0),
url : '/admin/api/file-upload',
runtimes : 'html5,flash,html4',
flash_swf_url : '/static/admin/Moxie.swf',
drop_element : $('.upload-area').get(0),
filters : {
max_file_size : '2mb',
prevent_duplicates : true
},
init : {
FilesAdded : function (up, files) {
for (var i = 0; i < files.length; i ++) {
fileUploadStart(files[i]);
}
completeFile = null;
uploader.start();
},
UploadComplete : function () {
if (completeFile) {
Typecho.uploadComplete(completeFile);
}
},
FileUploaded : function (up, file, result) {
if (200 == result.status) {
var data = $.parseJSON(result.response);
if (data) {
fileUploadComplete(file.id, data);
uploader.removeFile(file);
return;
}
}
fileUploadError.call(uploader, {
code : plupload.HTTP_ERROR,
file : file
});
},
Error : function (up, error) {
fileUploadError.call(uploader, error);
}
}
});
uploader.init();
});
function attachInsertEvent (el) {
$('.insert', el).click(function () {
var t = $(this), p = t.parents('li');
Typecho.insertFileToEditor(t.text(), p.data('url'), p.data('image'));
return false;
});
}
function attachDeleteEvent (el) {
var file = $('a.insert', el).text();
$('.delete', el).click(function () {
if (confirm('确认要删除文件 %s 吗?'.replace('%s', file))) {
var title = $(this).parents('li').data('title');
$.post('/admin/api/file-delete',
{'title' : title},
function () {
$(el).fadeOut(function () {
$(this).remove();
updateAttacmentNumber();
});
});
}
return false;
});
}
$('#file-list li').each(function () {
attachInsertEvent(this);
attachDeleteEvent(this);
});
});
</script>
{{end}}

View File

@@ -0,0 +1,125 @@
{{define "admin-posts"}}
<div class="body container">
<div class="typecho-page-title">
<h2>管理文章<a href="/admin/write-post">新增</a></h2>
</div>
<div class="row typecho-page-main" role="main">
<div class="col-mb-12 typecho-list">
<div class="typecho-list-operate clearfix">
<form method="get">
<div class="operate">
<label><i class="sr-only">全选</i>
<input type="checkbox" class="typecho-table-select-all" />
</label>
<div class="btn-group btn-drop">
<button class="btn dropdown-toggle btn-s" type="button"><i class="sr-only">操作</i>选中项 <i class="i-caret-down"></i></button>
<ul class="dropdown-menu">
<li><a lang="你确认要删除这些文章吗?" href="/admin/api/post-delete">删除</a></li>
</ul>
</div>
</div>
<div class="search" role="search">
{{if or .KW (gt .Serie 0)}}<a href="/admin/manage-posts">« 取消筛选</a>{{end}}
<input type="text" class="text-s" placeholder="请输入关键字" value="{{if .KW}}{{.KW}}{{end}}" name="keywords" />
<select name="serie">
<option value="">所有专题</option>
{{range .Series}}
<option {{if eq $.Serie .ID}}selected{{end}} value="{{.ID}}">{{.Name}}
{{end}}
</select>
<button type="submit" class="btn btn-s">筛选</button>
</div>
</form>
</div>
<!-- end .typecho-list-operate -->
<form method="post" name="manage_posts" class="operate-form">
<div class="typecho-table-wrap">
<table class="typecho-list-table">
<colgroup>
<col width="20" />
<col width="6%" />
<col width="40%" />
<col width="" />
<col width="12%" />
<col width="14%" />
<col width="14%" />
</colgroup>
<thead>
<tr>
<th> </th>
<th> </th>
<th>标题</th>
<th>作者</th>
<th>专题</th>
<th>创建</th>
<th>更新</th>
</tr>
</thead>
<tbody>
{{range .List}}
<tr id="post-{{.ID}}">
<td>
<input type="checkbox" value="{{.ID}}" name="cid[]" />
</td>
<td><a href="/post/{{.Slug}}.html#comments" class="balloon-button size-1">{{.Count}}</a></td>
<td>
<a href="/admin/write-post?cid={{.ID}}">{{.Title}}</a>
<a target="_blank" href="/post/{{.Slug}}.html" title="浏览 {{.Title}}"><i class="i-exlink"></i></a>
</td>
<td>{{.Author}}</td>
<td>{{if gt .SerieID 0}}专题ID:{{.SerieID}}{{else}}--{{end}}</td>
<td>{{dateformat .CreatedAt "06/01/02 15:04"}}</td>
<td>{{dateformat .UpdatedAt "06/01/02 15:04"}}</td>
</tr>
{{end}}
</tbody>
</table>
</div>
</form>
<!-- end .operate-form -->
<div class="typecho-list-operate clearfix">
<form method="get">
<div class="operate">
<label><i class="sr-only">全选</i>
<input type="checkbox" class="typecho-table-select-all" />
</label>
<div class="btn-group btn-drop">
<button class="btn dropdown-toggle btn-s" type="button"><i class="sr-only">操作</i>选中项 <i class="i-caret-down"></i></button>
<ul class="dropdown-menu">
<li><a lang="你确认要删除这些文章吗?" href="/admin/api/post-delete">删除</a></li>
</ul>
</div>
</div>
<ul class="typecho-pager">
{{if .Prev}}<li class="prev"><a href="/admin/manage-posts?{{html .Prev}}">«</a></li>{{end}}
{{range $k,$v := .PP}}
<li {{if eq $.Cur $k}}class="current"{{end}}><a href="/admin/manage-posts?{{html $v}}">{{$k}}</a></li>
{{end}}
{{if .Next}}<li class="next"><a href="/admin/manage-posts?{{html .Next}}">»</a></li>{{end}}
</ul>
</form>
</div>
<!-- end .typecho-list-operate -->
</div>
<!-- end .typecho-list -->
</div>
<!-- end .typecho-page-main -->
</div>
<script>
(function() {
$(document).ready(function() {
$('.typecho-list-table').tableSelectable({
checkEl: 'input[type=checkbox]',
rowEl: 'tr',
selectAllEl: '.typecho-table-select-all',
actionEl: '.dropdown-menu a,button.btn-operate'
});
$('.btn-drop').dropdownMenu({
btnEl: '.dropdown-toggle',
menuEl: '.dropdown-menu'
});
});
})();
</script>
{{end}}

View File

@@ -0,0 +1,166 @@
{{define "admin-profile"}}
<div class="body container">
<div class="typecho-page-title">
<h2>个人设置</h2>
</div>
{{with .Ei}}
<div class="row typecho-page-main">
<div class="col-mb-12 col-tb-3">
<p>
<img class="profile-avatar" src="//{{$.Qiniu.Domain}}/static/img/avatar.png" alt="{{.Blogger.BlogName}}" />
</p>
<h2>{{.Blogger.BlogName}}</h2>
<p>{{.Blogger.SubTitle}}</p>
<p>最后登录: {{dateformat .Account.LoginAt "2006/01/02 15:04"}}</p>
</div>
<div class="col-mb-12 col-tb-6 col-tb-offset-1 typecho-content-panel" role="form">
<section>
<h3>账号信息</h3>
<form action="/admin/api/account" method="post" enctype="application/x-www-form-urlencoded">
<ul class="typecho-option">
<li>
<label class="typecho-label" for="info-0-1">
个人邮箱</label>
<input id="info-0-1" name="email" type="text" class="text" value="{{.Account.Email}}" />
<p class="description">
用于发送告警邮件及其它通知, 建议填写, 如: example@163.com.</p>
</li>
</ul>
<ul class="typecho-option">
<li>
<label class="typecho-label" for="info-0-2">
移动电话</label>
<input id="info-0-2" name="phoneNumber" type="text" class="text" value="{{.Account.PhoneN}}" />
<p class="description">
选择填写, 如: 8615123456789.</p>
</li>
</ul>
<ul class="typecho-option">
<li>
<label class="typecho-label" for="info-0-3">
家庭住址</label>
<input id="info-0-3" name="address" type="text" class="text" value="{{.Account.Address}}" />
<p class="description">
选择填写, 如: xx省xx市xx区(县)xxxx小区xxx号.</p>
</li>
</ul>
<ul class="typecho-option typecho-option-submit">
<li>
<button type="submit" class="btn primary">
更新账号信息</button>
</li>
</ul>
</form>
</section>
<br>
<section>
<h3>博客信息</h3>
<form action="/admin/api/blog" method="post" enctype="application/x-www-form-urlencoded">
<ul class="typecho-option">
<li>
<label class="typecho-label" for="blog-0-1">
博客昵称 *</label>
<input id="blog-0-1" name="blogName" type="text" class="text" value="{{.Blogger.BlogName}}" />
<p class="description">
用户昵称可以与用户名不同, 用于前台显示.
<br />如果你将此项留空, 将默认使用登录用户名.</p>
</li>
</ul>
<ul class="typecho-option">
<li>
<label class="typecho-label" for="blog-0-2">
标题显示 *</label>
<input id="blog-0-2" name="bTitle" type="text" class="text" value="{{.Blogger.BTitle}}" />
<p class="description">
用于所有页面的title组成, 如: Deepzz's Blog</p>
</li>
</ul>
<ul class="typecho-option">
<li>
<label class="typecho-label" for="blog-0-3">
个人格言</label>
<input id="blog-0-3" name="subTitle" type="text" class="text" value="{{.Blogger.SubTitle}}" />
<p class="description">
简介或格言, 如: 生活百般滋味, 人生需要笑对.</p>
</li>
</ul>
<ul class="typecho-option">
<li>
<label class="typecho-label" for="blog-0-4">
备案号</label>
<input id="blog-0-4" name="beiAn" type="text" class="text" value="{{.Blogger.BeiAn}}" />
<p class="description">
用于底部显示, 不添加则不显示, 如: 蜀 ICP 备 16021362 号</p>
</li>
</ul>
<ul class="typecho-option">
<li>
<label class="typecho-label" for="blog-0-5">
专题前说</label>
<textarea id="blog-0-5" name="seriessay">{{.Blogger.SeriesSay}}</textarea>
<p class="description">
此文字用于专题前述, 会在专题最前方显示.</p>
</li>
</ul>
<ul class="typecho-option">
<li>
<label class="typecho-label" for="blog-0-6">
归档前说</label>
<textarea id="blog-0-6" name="archivessay">{{.Blogger.ArchivesSay}}</textarea>
<p class="description">
此文字用于归档前述, 会在归档最前方显示.</p>
</li>
</ul>
<ul class="typecho-option typecho-option-submit" id="typecho-option-item-submit-4">
<li>
<button type="submit" class="btn primary">
更新博客信息</button>
</li>
</ul>
</form>
</section>
<br>
<section id="change-password">
<h3>密码修改</h3>
<form action="/admin/api/password" method="post" enctype="application/x-www-form-urlencoded">
<ul class="typecho-option" id="typecho-option-item-oldpwd-11">
<li>
<label class="typecho-label" for="password-0-11">
原始密码</label>
<input id="password-0-11" name="old" type="password" class="w-60" />
<p class="description">
该账户旧密码.</p>
</li>
</ul>
<ul class="typecho-option" id="typecho-option-item-newpwd-12">
<li>
<label class="typecho-label" for="password-0-12">
用户密码</label>
<input id="password-0-12" name="new" type="password" class="w-60" />
<p class="description">
为此用户分配一个密码.
<br />建议使用特殊字符与字母、数字的混编样式,以增加系统安全性.</p>
</li>
</ul>
<ul class="typecho-option" id="typecho-option-item-confirm-13">
<li>
<label class="typecho-label" for="confirm-0-13">
用户密码确认</label>
<input id="confirm-0-13" name="confirm" type="password" class="w-60" />
<p class="description">
请确认你的密码, 与上面输入的密码保持一致.</p>
</li>
</ul>
<ul class="typecho-option typecho-option-submit" id="typecho-option-item-submit-14">
<li>
<button type="submit" class="btn primary">
更新密码</button>
</li>
</ul>
</form>
</section>
</div>
</div>
{{end}}
</div>
{{end}}

View File

@@ -0,0 +1,74 @@
{{define "admin-serie"}}
<div class="body container">
<div class="typecho-page-title">
{{if .Edit}}
<h2>编辑 {{with .Edit}}{{.Name}}{{end}}</h2>
{{else}}
<h2>新增专题</h2>
{{end}}
</div>
<div class="row typecho-page-main" role="form">
<div class="col-mb-12 col-tb-6 col-tb-offset-3">
<form action="/admin/api/serie-add" method="post" enctype="application/x-www-form-urlencoded">
<ul class="typecho-option" id="typecho-option-item-name-0">
<li>
<label class="typecho-label" for="name-0-1">
专题名称 *</label>
<input id="name-0-1" name="name" type="text" class="text" {{with .Edit}}value="{{.Name}}"{{end}} />
</li>
</ul>
<ul class="typecho-option" id="typecho-option-item-slug-1">
<li>
<label class="typecho-label" for="slug-0-2">
专题缩略名</label>
<input id="slug-0-2" name="slug" type="text" class="text" {{with .Edit}}value="{{.Slug}}"{{end}} />
<p class="description">
专题缩略名用于创建友好的链接形式, 建议使用字母, 数字, 下划线和横杠.</p>
</li>
</ul>
<ul class="typecho-option" id="typecho-option-item-description-3">
<li>
<label class="typecho-label" for="description-0-3">
专题描述</label>
<textarea id="description-0-3" name="description">{{with .Edit}}{{.Desc}}{{end}} </textarea>
<p class="description">
此文字用于描述专题, 在有的主题中它会被显示.</p>
</li>
</ul>
<input type="hidden" name="mid" {{with .Edit}}value="{{.ID}}"{{end}} />
<ul class="typecho-option typecho-option-submit" id="typecho-option-item--6">
<li>
<button type="submit" class="btn primary">
{{if .Edit}}更新专题{{else}}新增专题{{end}}</button>
</li>
</ul>
</form>
</div>
</div>
</div>
<script>
(function () {
$(document).ready(function () {
var error = $('.typecho-option .error:first');
if (error.length > 0) {
$('html,body').scrollTop(error.parents('.typecho-option').offset().top);
}
$('form').submit(function () {
if (this.submitted) {
return false;
} else {
this.submitted = true;
}
});
$('label input[type=text]').click(function (e) {
var check = $('#' + $(this).parents('label').attr('for'));
check.prop('checked', true);
return false;
});
});
})();
</script>
{{end}}

View File

@@ -0,0 +1,110 @@
{{define "admin-series"}}
<div class="body container">
<div class="typecho-page-title">
<h2>管理专题<a href="/admin/add-serie">新增</a></h2>
</div>
<div class="row typecho-page-main manage-metas">
<div class="col-mb-12" role="main">
<form method="post" name="manage_categories" class="operate-form">
<div class="typecho-list-operate clearfix">
<div class="operate">
<label><i class="sr-only">全选</i>
<input type="checkbox" class="typecho-table-select-all" />
</label>
<div class="btn-group btn-drop">
<button class="btn dropdown-toggle btn-s" type="button"><i class="sr-only">操作</i>选中项 <i class="i-caret-down"></i></button>
<ul class="dropdown-menu">
<li><a lang="此分类下的所有内容将被删除, 你确认要删除这些分类吗?" href="/admin/api/serie-delete">删除</a></li>
</ul>
</div>
</div>
<div class="search" role="search">
</div>
</div>
<div class="typecho-table-wrap">
<table class="typecho-list-table">
<colgroup>
<col width="20" />
<col width="10%" />
<col width="45%" />
<col width="30%" />
<col width="10%" />
</colgroup>
<thead>
<tr class="nodrag">
<th> </th>
<th>ID</th>
<th>名称</th>
<th>创建</th>
<th>文章数</th>
</tr>
</thead>
<tbody>
{{range .List}}
<tr id="mid-category-{{.ID}}">
<td>
<input type="checkbox" value="{{.ID}}" name="mid[]" />
</td>
<td>{{.ID}}</td>
<td>
<a href="/admin/add-serie?mid={{.ID}}">{{.Name}}</a>
<a target="_blank" href="/series.html#toc-{{.ID}}" title="浏览 {{.Name}}"><i class="i-exlink"></i></a>
</td>
<td>{{dateformat .CreatedAt "2006/01/02 15:04"}}</td>
<td><a class="balloon-button left size-50" href="#">{{len .Articles}}</a></td>
</tr>
{{end}}
</tbody>
</table>
</div>
</form>
</div>
</div>
</div>
<script type="text/javascript">
(function() {
$(document).ready(function() {
var table = $('.typecho-list-table').tableDnD({
onDrop: function() {
var ids = [];
$('input[type=checkbox]', table).each(function() {
ids.push($(this).val());
});
$.post('/admin/api/move',
$.param({
mid: ids
}));
$('tr', table).each(function(i) {
if (i % 2) {
$(this).addClass('even');
} else {
$(this).removeClass('even');
}
});
}
});
table.tableSelectable({
checkEl: 'input[type=checkbox]',
rowEl: 'tr',
selectAllEl: '.typecho-table-select-all',
actionEl: '.dropdown-menu a'
});
$('.btn-drop').dropdownMenu({
btnEl: '.dropdown-toggle',
menuEl: '.dropdown-menu'
});
$('.dropdown-menu button.merge').click(function() {
var btn = $(this);
btn.parents('form').attr('action', btn.attr('rel')).submit();
});
});
})();
</script>
{{end}}

View File

@@ -0,0 +1,58 @@
{{define "admin-tags"}}
<div class="body container">
<div class="typecho-page-title">
<h2>管理标签</h2>
</div>
<div class="row typecho-page-main manage-metas">
<div class="col-mb-12 col-tb-8" role="main">
<form method="post" name="manage_tags" class="operate-form">
<div class="typecho-list-operate clearfix">
<div class="operate">
<label><i class="sr-only">全选</i>
<input type="checkbox" class="typecho-table-select-all" />
</label>
<div class="btn-group btn-drop">
<button class="btn dropdown-toggle btn-s" type="button"><i class="sr-only">操作</i>选中项 <i class="i-caret-down"></i></button>
<!-- <ul class="dropdown-menu"> -->
<!-- <li><a lang="你确认要删除这些标签吗?" href="/admin/api/tag-delete">删除</a></li> -->
<!-- </ul> -->
</div>
</div>
</div>
<ul class="typecho-list-notable tag-list clearfix">
{{range $k,$v:=.List}}
<li class="size-5"><input type="checkbox" name="mid[]" />{{$k}}<i class="i-edit"></i></li>
{{end}}
</ul>
</form>
</div>
<div class="col-mb-12 col-tb-4" role="form">
<p>  夏雷在天际回响<br>  纸船在水中荡漾<br>  时间就这么走了<br>  远离了三年的学堂<br>  <br>  是否还记得前排的那个姑凉<br>  如今你又彷徨在谁的身旁<br>  那时我们都太迷茫<br>  沉醉在青春路上<br>  <br>  嘴角扬起的微笑<br>  那是我们最美好的时光<br>  那个女孩的嘴角<br>  深深地印在我的胸膛<br>  <br>  青春是多么昂扬<br>  奏响生命的乐章<br>  雨中漫步的时光<br>  在记忆流逝中远航<br>  <br>  别了,我亲爱的课堂<br>  别了,我最好的同窗<br>  别了,敬爱三年的师长<br>  我多么希望,记忆停留归航<br>  2016/9.9殇星<br>  </p>
</div>
</div>
</div>
<script type="text/javascript">
(function () {
$(document).ready(function () {
$('.typecho-list-notable').tableSelectable({
checkEl : 'input[type=checkbox]',
rowEl : 'li',
selectAllEl : '.typecho-table-select-all',
actionEl : '.dropdown-menu a'
});
$('.btn-drop').dropdownMenu({
btnEl : '.dropdown-toggle',
menuEl : '.dropdown-menu'
});
$('.dropdown-menu button.merge').click(function () {
var btn = $(this);
btn.parents('form').attr('action', btn.attr('rel')).submit();
});
});
})();
</script>
{{end}}

View File

@@ -0,0 +1,82 @@
{{define "admin-trash"}}
<div class="body container">
<div class="typecho-page-title">
<h2>回收箱</h2>
</div>
<div class="row typecho-page-main manage-metas">
<div class="col-mb-12" role="main">
<form method="post" name="manage_trash" class="operate-form">
<div class="typecho-list-operate clearfix">
<div class="operate">
<label><i class="sr-only">全选</i>
<input type="checkbox" class="typecho-table-select-all" />
</label>
<div class="btn-group btn-drop">
<button class="btn dropdown-toggle btn-s" type="button"><i class="sr-only">操作</i>选中项 <i class="i-caret-down"></i></button>
<ul class="dropdown-menu">
<li><a lang="你确认要恢复该文章到草稿箱吗?" href="/admin/api/trash-recover">恢复</a></li>
<li><a lang="此回收箱下的所有内容将被删除, 你确认要删除这些文章吗?" href="/admin/api/trash-delete">删除</a></li>
</ul>
</div>
</div>
<div class="search" role="search">
</div>
</div>
<div class="typecho-table-wrap">
<table class="typecho-list-table">
<colgroup>
<col width="20" />
<col width="40%" />
<col width="" />
<col width="12%" />
<col width="14%" />
<col width="14%" />
</colgroup>
<thead>
<tr>
<th> </th>
<th>标题</th>
<th>作者</th>
<th>专题</th>
<th>创建</th>
<th>删除</th>
</tr>
</thead>
<tbody>
{{range .List}}
<tr id="mid-article-{{.ID}}">
<td>
<input type="checkbox" value="{{.ID}}" name="mid[]" />
</td>
<td>{{.Title}}</td>
<td>{{.Author}}</td>
<td>{{if gt .SerieID 0}}专题ID:{{.SerieID}}{{else}}--{{end}}</td>
<td>{{dateformat .CreatedAt "2006/01/02 15:04"}}</td>
<td>{{dateformat .DeletedAt "2006/01/02 15:04"}}</td>
</tr>
{{end}}
</tbody>
</table>
</div>
</form>
</div>
</div>
</div>
<script>
(function() {
$(document).ready(function() {
$('.typecho-list-table').tableSelectable({
checkEl: 'input[type=checkbox]',
rowEl: 'tr',
selectAllEl: '.typecho-table-select-all',
actionEl: '.dropdown-menu a,button.btn-operate'
});
$('.btn-drop').dropdownMenu({
btnEl: '.dropdown-toggle',
menuEl: '.dropdown-menu'
});
});
})();
</script>
{{end}}

View File

@@ -0,0 +1 @@
{{define "archives"}}<div id=content class=inner><article class="post post-archives"><h1 class=title>归档</h1><div class="entry-content">{{str2html .Article}}</div></article></div>{{end}}

View File

@@ -0,0 +1 @@
{{define "article"}}<div id=content class=inner>{{with .Article}}<article class="post post-{{.ID}}" itemscope itemtype="http://schema.org/Article"><div class=meta><div class=date><time itemprop=datePublished content="{{dateformat .CreatedAt "2006-01-02T15:04:05Z07:00"}}">{{dateformat .CreatedAt "Jan 02, 2006"}}</time></div><div class="date-modified"><time itemprop=dateModified content="{{dateformat .UpdatedAt "2006-01-02T15:04:05Z07:00"}}">{{dateformat .UpdatedAt "Jan 02, 2006"}}</time></div><div class=comment><a href="#comments">{{.Count}} Comments</a></div></div><h1 class=title itemprop=headline>{{.Title}}</h1><div class="entry-content" itemprop=articleBody>{{str2html .Header}}{{str2html .Content}}<p>本文链接:<a rel="bookmark" title="Permalink to {{.Title}}" href="//{{$.Domain}}/post/{{.Slug}}.html" itemprop="url">https://{{$.Domain}}/post/{{.Slug}}.html</a><a href="//{{$.Domain}}/post/{{.Slug}}.html#comments">参与评论 »</a></p><p>--<acronym title="End of File">EOF</acronym>--</p><p class="post-info">发表于 <span class="date">{{dateformat .CreatedAt "2006-01-02 15:04:05"}}</span>{{if gt (.Tags|len) 0}},并被添加「{{range $index, $elem := .Tags}}{{if gt $index 0}}、{{end}}<a href="/search.html?q=tag:{{$elem}}">{{$elem}}</a>{{end}}」标签{{end}}{{if .UpdatedAt|isnotzero}},最后修改于 <span class="date">{{dateformat .UpdatedAt "2006-01-02 15:04:05"}}</span>{{end}}。</p>{{with $.Copyright}}<p class="copyright-info">{{str2html $.Copyright}}<a href="//{{$.Domain}}/post/about.html#toc_1">更多说明 »</a></p>{{end}}{{if gt $.Days 100}}<p class="expire-tips">提醒:本文最后更新于 {{$.Days}} 天前,文中所描述的信息可能已发生改变,请谨慎使用。</p>{{end}}{{with $.Serie}}<div class="entry-series"><h3>专题「{{.Name}}」的其它文章 <a href="/series.html#toc-{{.ID}}" title="更多">»</a></h3><ul>{{range .Articles}}{{if ne .ID $.Article.ID}}<li><a href="/post/{{.Slug}}.html">{{.Title}}</a> <span class="date">({{dateformat .CreatedAt "Jan 02, 2006"}})</span></li>{{end}}{{end}}</ul></div>{{end}}</div></article><nav class="page-navi">{{with .Prev}}<a href="/post/{{.Slug}}.html" class=prev>« {{.Title}}</a>{{end}}{{with .Next}}<a href="/post/{{.Slug}}.html" class=next>{{.Title}} »</a>{{end}}</nav><section id=comments><h1 class=title>Comments</h1><div class=total_thread data-identifier="post-{{.Slug}}" data-url="https://{{$.Domain}}/post/{{.Slug}}.html"></div></section>{{end}}</div>{{end}}

View File

@@ -0,0 +1 @@
{{define "blogroll"}}<div id=content class=inner>{{with .Article}}<article class="post post-{{.ID}}" itemscope itemtype="http://schema.org/Article"><h1 class=title itemprop=headline>{{.Title}}</h1><div class="entry-content" itemprop=articleBody><style>.links.ssl li{position:relative;padding-left:22px}.links.ssl li::before{content:'';display:block;position:absolute;top:6px;left:0;width:16px;height:16px;background-size:16px 16px;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAD/0lEQVR4Ab2XA5hjOxTHO9batrdce8yrtW2b9dgq1jae1vbueOpn2zbzcoqP06luJ993epXk/0vOOUnK8abkq6Ttb1r2UY8+PJzx4L1DZY8/PrzrxYqySYqsXeEcf5Z+I9r3WlI0MjfzVoKx4Gnaj4XP0pDd/sl/kvq1/HJsxXSxcHP7Hs1bsS4+fSt3RXkt9ZVaz6DyehqpDTTSWI3503bF7+sopDEyqOBxqnks02Mia+IzxTyp1jwZlVSRVlHpS3F3qfWDV49I7TZmFNGdP4rqHj1LIhDn3Es2qfU0Kq0hAfLncVN7pvksTq0fNH+fxSZeVkN+kbSk/0xnddt1jYyanyGSaoz031BfpaO+5U7qyPVavAe3VdeSavIzq3gt+RUe0Qg3Z2wFnol/wSXSl+NuRzQPCfIKYGnOCDn4FHf2H71+8CJP2q7fN3Y/xIrWxKCYWX0SPBZv2SkyPOd+qlFVTyH5lfjaiGYhwZ607y1o07e0mvxBraPRhiMTD3qecsPbDsDB9CtE93ylUMLxouy+EHNLjdsrriXoIluGBrrdMDAoMHjslB7RkGoQ1ROm95wRGBQQFBwSGOqu4fqBC7OGlWuNDKwTH3Qf3KpLUHBgSKPCe8/u5G0+Lri343S0Hk/7e0UVxH9gslfi3ttxepJu59loo7sG9TNvJX5RXEn8hwH+FF+KfQ2/N6zbxz11+9Gl1g0C3Hm/5GB+VRyOeArSDvIZ7mEWIJg8NlU9beurGveFDe7zq+LRa9/cndsgwPU3C09kPYq2Lq+Y/C/xC7FPdpyZdAuT3/HW8EzcVF5NMJRUEdZ+oX/TF7eXOgM4BhWAfFX5aA2HpdK2a1SE4mpCJZ4JB8DiRgEg8meJBWs5LBY8E+fBBW4DzJEJN3s12u5RUQ29x+645HeAntzW3fIfp9bMkQv2NDlAL17rbtn3kusdy+88pXB3UwGAeA8Qh82n8Gka2mue3HQANvEkPYhDmmnNDMK74Va/uKBF27DQlWWjFH1Fbfs4F+dv9UsQtu0a2XrrsQmnD745FSmvJ1RNmNFrEr7Wldc7F2cVIGFxP/rw29MQPoxal2ks/BdcnYuzDBASFhQ0cw9/J5wNi+ynYbjC8ywxf4sTXfaDEIvZIJ4TIA4j3wTvmwrAAbH70NvTfnFn5H5Lw1FEt+Fw9RvAbIlgA6ub0ZnoC24DwL8ffJwSswmAT0Q3SmtcAxyHCvgYhnIfpnyGITJnywQ78Oay21ubLRVsx2cLbXEF8Xvh87TGAW6+U3gq8+FElP80GRU+T0HlOhKp9L5bWT2B148Ua79Zjyciy9dOTkTnKwqogidp76mqZnyjqpzxNdumrp75bfa9lNqK1272d2j+D+LY/CDPYPo9AAAAAElFTkSuQmCC)}.links li .more{color:#999;font-size:14px}</style>{{str2html .Content}}<p>注:为了节约本站用户的宝贵时间,长期无法访问的链接会被移除!另本站只有友情链接,不接受链接交换。</p></div></article>{{end}}</div>{{end}}

View File

@@ -0,0 +1 @@
<!Doctype html><html lang="zh-CN"><head><meta charset="utf-8"><meta content="width=device-width,minimum-scale=1.0" name=viewport><meta name="format-detection" content="telephone=no"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name=referrer content=always><meta name=robots content="noindex, nofollow, noarchive"><title>{{.Title}}</title><style type="text/css">*{margin:0;padding:0}html,body{height:100%}body{background:#fff;color:#2a2e2e;font-size:15px;font-family:"Helvetica Neue",arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}::selection,::-moz-selection,::-webkit-selection{background-color:#2479CC;color:#eee}h3{font-size:1.3em;line-height:1.5;margin:15px 30px;text-align:center}a{color:#2479CC;text-decoration:none}.card{margin:15px 25px;text-align:left}.submit input,.submit textarea{-webkit-appearance:none;border:1px solid #bbb;border-radius:1px;font-size:15px;height:20px;line-height:20px;margin-left:10px;padding:6px 8px}.submit span{position:relative;top:8px}.submit li{display:-webkit-box;display:-ms-flexbox;display:flex;margin:15px 0}.submit textarea{height:130px}.submit .line{-webkit-box-flex:1;display:block;-ms-flex:1;flex:1}.submit .btn-submit{-webkit-appearance:none;background:#12b0e6;border:none;border-radius:0;box-shadow:inset 0 -5px 20px rgba(0,0,0,.1);color:#fff;cursor:pointer;display:block;font-size:14px;line-height:1;padding:0.625em .5em;width:100%}.submit li.tips{color:#999;font-size:14px}</style></head><body><header><h3>对「{{.ATitle}}」发表评论</h3></header><div class=bd><div class="card submit"><form onsubmit="return false" id="create-post"><ul><li><span>昵称:</span><input class=line name=author_name required placeholder="昵称会被公开显示"><li><span>邮箱:</span><input class=line name=author_email type=email required placeholder="邮箱不会公开显示"><li><span>内容:</span><textarea class="line" name="message" required placeholder="请不要发表无意义的评论内容"></textarea><li><input type=hidden name=thread value="{{.Thread}}"><input type=hidden name=parent value=""><input type=hidden name=identifier value="post-{{.Slug}}"><input type=hidden name=next value=""><button class="btn-submit" type=submit>立即发表</button><li class=tips>注:通过本表单提交的数据,会原样转发给 Disqus本站不做任何存储和记录。<li><a href="#close" onclick="window.close();void(0)">放弃评论</a></ul></form></div></div><footer></footer><script src="https://cdn.bootcss.com/jquery/3.1.1/jquery.min.js" ></script><script>!function(a){function e(){try{localStorage.author_name=$('[name="author_name"]').val(),localStorage.author_email=$('[name="author_email"]').val()}catch(a){}}function t(){$('[name="author_name"]').val(localStorage.author_name),$('[name="author_email"]').val(localStorage.author_email),["author_name","author_email","message"].some(function(a){var e=$('[name="'+a+'"]');return e.val()?void 0:e.focus()})}var o=!1;$("#create-post").on("submit",function(e){if(e.preventDefault(),!o){o=!0;var t=$(".tips");t.html("提交中..."),$.post("/disqus/create",$("#create-post").serialize()).then(function(e){o=!1,e.errno?t.html("提交失败:"+e.errmsg):($(".btn-submit").prop("disabled",!0),t.html("提交成功!本窗口即将关闭。"),setTimeout(function(){try{a.opener.location.hash="comment-"+e.data.id,a.opener.TotalThread.currentServer.insertItem(e.data),a.close()}catch(t){a.close()}},1e3))})}}),t(),$('[name="author_name"], [name="author_email"]').on("change",e)}(this)</script></body></html>

View File

@@ -0,0 +1 @@
{{define "home"}}<div id="content" class="inner">{{range .List}}<article class="post post-list"><div class="meta"><div class="date"><time>{{dateformat .CreatedAt "Jan 02, 2006"}}</time></div><div class="comment"><a href="/post/{{.Slug}}.html#comments">{{.Count}} Comments</a></div></div><h1 class="title"><a href="/post/{{.Slug}}.html">{{.Title}}</a></h1><div class="entry-content"><p>{{str2html .Excerpt}}[...]</p><p><a href="/post/{{.Slug}}.html" class="more-link">继续阅读 »</a></p></div></article>{{end}}<nav class="page-navi">{{if gt .Prev 0}}<a href="?pn={{.Prev}}" class="prev">« 上一页</a>{{end}}{{if gt .Next 0}}<a href="?pn={{.Next}}" class="next">下一页 »</a>{{end}}<div class="center"><a href="/archives.html">博客归档</a></div></nav></div>{{end}}

View File

@@ -0,0 +1 @@
<!DOCTYPE html><html lang="zh-cn"><head><meta charset="utf-8"><meta content="width=device-width,minimum-scale=1.0" name="viewport"><meta name="format-detection" content="telephone=no"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="referrer" content="always"><title>{{.Title}}</title>{{.AdSense}}<script>!function(n,t){function e(){o("nls",1)}function c(){t.documentElement.style.display="none",u(),location.reload()}function r(n){var t="";try{t=f[n]||"",t.length<99&&c()}catch(e){u()}return t}function i(n,t){try{f[n]=t,t!==f[n]&&u()}catch(e){u()}}function o(n,e){var c=999;e||(c=-1),c=new Date(+new Date+864e5*c).toGMTString();var r=n+"="+e+";path=/;secure;expires="+c;t.cookie=r}function a(n){var e=t.getElementById(n).innerHTML;i(n,e)}function l(e,c){var i=r(e),o=t.createElement(c?"script":"style");return n.execScript&&c?n.execScript(i):(o.innerHTML=i,void t.head.appendChild(o))}function u(){o("v",0)}var f,h=function(){},d=n.L={h:h,l:h,c:h};try{f=localStorage,d.h=a,d.l=l,d.c=o}catch(p){e()}}(this,document);</script>{{if .Version}}<script>L.c('v', {{.Version}})</script>{{end}}<link rel="apple-touch-icon" href="//{{.Qiniu.Domain}}/static/img/favicon.ico"><link rel="search" type="application/opensearchdescription+xml" href="//{{.Domain}}/opensearch.xml" title="{{.BTitle}}">{{if .Version}}<style id="blog_css">{{template "blog_css" .}}</style><script>L.h('blog_css')</script>{{else}}<script>L.l("blog_css")</script>{{end}}<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="//{{.Domain}}/rss.html"><meta name="description" content="{{.Description}}"><meta name="twitter:card" content={{.Twitter.Card}}><meta name="twitter:site" content="@{{.Twitter.Site}}"><meta name="twitter:title" content="{{.Title}}"><meta name="twitter:description" content="{{.Description}}"><meta name="twitter:image" content="https://{{.Twitter.Image}}"></head><body><div class="container"><div class="left-col"><div class="intrude-less"><header id="header" class="inner"><div class="profilepic"><a href="/"></a></div><h1><a href="/">{{.BlogName}}</a></h1><p class="subtitle">{{.SubTitle}}</p><nav id="main-nav"><ul><li {{if eq .Path "/"}}class="on" {{end}}><a href="/"><span>首页</span></a></li><li {{if eq .Path "/series.html"}}class="on" {{end}}><a href="/series.html"><span>专题</span></a></li><li {{if eq .Path "/archives.html"}}class="on" {{end}}><a href="/archives.html"><span>归档</span></a></li><li {{if eq .Path "/post/blogroll.html"}}class="on" {{end}}><a href="/post/blogroll.html"><span>友链</span></a></li><li {{if eq .Path "/post/about.html"}}class="on" {{end}}><a href="/post/about.html"><span>关于</span></a></li></ul></nav><nav id="sub-nav"><div class="social"><a target="_blank" class="twitter external" rel="nofollow" href="//{{.Twitter.Address}}" title="Twitter" aria-label="Twitter">Twitter</a><a target="_blank" class="rss" href="//{{.Domain}}/rss.html" title="RSS 订阅" aria-label="RSS 订阅">RSS</a><a class="search" href="/search.html" title="站内搜索" aria-label="站内搜索">Search</a></div></nav></header></div></div><div class="mid-col"><div class="mid-col-container">{{.LayoutContent}}</div><footer id=footer class=inner>© {{.CopyYear}} - {{.BTitle}}{{if .BeiAn}} - <a target="_blank" rel="nofollow designer" class="external beian" href="https://beian.miit.gov.cn">{{.BeiAn}}</a>{{end}}<br>Powered by <a target=_blank href="//github.com/eiblog/eiblog">Eiblog</a> & <a target=_blank rel="nofollow designer" class=external href="//github.com/deepzz0">Deepzz</a></footer></div></div><input type=hidden id=CURRENT_PAGE value="{{.CurrentPage}}"><input type=hidden id=CDN_DOMAIN value="//{{.Qiniu.Domain}}">{{if .Version}}<script id="ana_js">{{template "ana_js"}}</script><script>L.h('ana_js')</script>{{else}}<script>L.l('ana_js', 1)</script>{{end}}{{if .Version}}<script id="jq_js">{{template "jq_js"}}</script><script>L.h('jq_js')</script>{{else}}<script>L.l('jq_js', 1)</script>{{end}}{{if .Version}}<script id="hl_js">{{template "hl_js"}}</script><script>L.h('hl_js')</script>{{else}}<script>L.l('hl_js', 1)</script>{{end}}{{if .Version}}<script id="blog_js">{{template "blog_js" .}}</script><script>L.h('blog_js')</script>{{else}}<script>L.l('blog_js', 1)</script>{{end}}</body></html>

View File

@@ -0,0 +1 @@
{{define "search"}}<div id="content" class="inner"><article class="post post-search"><h1 class="title">站内搜索</h1><div class="entry-content"><div id="search"><form action="/search.html"><div class="wrapper"><input maxlength="80" placeholder="请输入关键字..." id="keyword" name="q" {{if .Word}}value="{{.Word}}"{{end}} type="search" required></div><input class="submit" type="submit" value="搜索"></form></div><div id="searchResult">{{if .Word}}{{with .SearchResult}}{{if gt (.Hits.Hits|len) 0}}<div class="info">本次搜索共找到结果 {{.Hits.Total}} 条 (用时 {{.Took}} 秒)</div>{{range .Hits.Hits}}<div class="item"><div class="title"><a href="/post/{{.Source.Slug}}.html">{{if .Highlight.Title}}{{str2html (join .Highlight.Title "")}}{{else}}{{.Source.Title}}{{end}}</a></div><div class="desc">{{if .Source.Img}}<div class="img"><img data-src="{{.Source.Img}}?imageView2/1/w/216/h/162"></div>{{end}}<div class="summary"><span class="date">{{dateformat .Source.Date "2006-01-02"}}</span> ... {{str2html (join .Highlight.Content "...")}} ...</div></div></div>{{end}}{{else}}<div class="no-result">没有找到任何结果,请更换查询词试试~</div><div class="item"><div class="title">或者试试 Google 站内搜索:<a target="_blank" href="//www.google.com/#q=site:{{$.Domain}} {{$.Word}}">site:{{$.Domain}} {{$.Word}}</a></div></div>{{end}}{{end}}{{else}}<div class="hot-words">热搜词:{{range .HotWords}}<a href="?q={{.}}">{{.}}</a>{{end}}</div><div class="intro"><p>支持的搜索格式:</p><ol><li>输入关键词全文搜索:<a href="?q=Let's Encrypt">Let's Encrypt</a></li><li>指定时间段搜索:<a href="?q=date:2016">date:2016</a><a href="?q=date:2016-10">date:2016-10</a></li><li>指定标签搜索:<a href="?q=tag:github">tag:github</a><a href="?q=tag:HTTPS">tag:HTTPS</a></li><li>组合搜索:<a href="?q=date:2016 tag:docker">date:2016 tag:docker</a></li></ol></div>{{end}}</div></div></article>{{if or .Prev .Next}}<nav class="page-navi">{{with .Prev}}<a href="?{{html .}}" class="prev">« 上一页</a>{{end}}{{with .Next}}<a href="?{{html .}}" class="next">下一页 »</a>{{end}}</nav>{{end}}</div>{{end}}

View File

@@ -0,0 +1 @@
{{define "series"}}<div id=content class=inner><article class="post post-series"><h1 class=title>专题</h1><div class="entry-content">{{str2html .Article}}</div></article></div>{{end}}

View File

@@ -0,0 +1,3 @@
{{define "ana_js"}}
!function(e,n,o){var t=e.screen,a=encodeURIComponent,r=["dt="+a(n.title),"dr="+a(n.referrer),"ul="+(o.language||o.browserLanguage).toLowerCase(),"sd="+t.colorDepth+"-bit","sr="+t.width+"x"+t.height,"_="+ +new Date],i="?"+r.join("&");e.__beacon_img=new Image,e.__beacon_img.src="/beacon.html"+i}(window,document,navigator,location);
{{end}}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -16,7 +16,7 @@ import (
var xmlTmpl *template.Template
func init() {
root := filepath.Join(config.WorkDir, "website", "template", "*.xml")
root := filepath.Join(config.EtcDir, "template", "*.xml")
var err error
xmlTmpl, err = template.New("").Funcs(template.FuncMap{

View File

@@ -17,17 +17,10 @@ var htmlTmpl *template.Template
func init() {
htmlTmpl = template.New("eiblog").Funcs(tools.TplFuncMap)
root := filepath.Join(config.WorkDir, "website")
root := filepath.Join(config.EtcDir, "website")
files := tools.ReadDirFiles(root, func(fi fs.DirEntry) bool {
name := fi.Name()
if strings.HasPrefix(name, ".") {
return true
}
// should not read template dir
if fi.IsDir() && name == "template" {
return true
}
return false
// should not read dir & .DS_Store
return strings.HasPrefix(fi.Name(), ".") || fi.IsDir()
})
_, err := htmlTmpl.ParseFiles(files...)
if err != nil {

View File

@@ -43,7 +43,7 @@ func runHTTPServer(endRun chan error) {
swag.RegisterRoutes(e)
// static files, page
e.Static("/static", filepath.Join(config.WorkDir, "assets"))
e.Static("/static", filepath.Join(config.EtcDir, "assets"))
// static files
file.RegisterRoutes(e)