diff --git a/.gitignore b/.gitignore index 0a7d389..d21056b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,8 @@ node_modules *.log .idea -.vscode \ No newline at end of file +.vscode +.DS_Store +*.DS_Store +._* +npm-debug.log diff --git a/config/settings.json b/config/settings.json index 3cea6c5..3e47b27 100644 --- a/config/settings.json +++ b/config/settings.json @@ -1,10 +1,13 @@ { "SiteName": "iBlog", + "Author": "You Name", + "Email": "you_email@xxx.com", "SiteDomain": "www.example.com", "RecordNo": "浙ICP备XXX号", "LogoPath": "/static/images/zhr.jpg", "PageSize": "10", "ExpandMenu": "true", + "ShowArticleSign": "false", "Editor": "", "CacheExpired": "300", "TranslateKey": "y2RIaF6RifHnJeD1Szzw", diff --git a/language/zh-CN.json b/language/zh-CN.json index 10ed09b..0919bd4 100644 --- a/language/zh-CN.json +++ b/language/zh-CN.json @@ -179,6 +179,7 @@ "posts_per_page": "每页显示文章数", "posts_per_page_placeholder": "每页的条数", "show_summary": "默认展开文章目录", + "show_article_sign": "显示文尾版权申明", "cache_expire_time": "缓存过期时间(秒)", "cache_expire_time_placeholder": "缓存过期时间", "utility": "组件设置", @@ -204,7 +205,11 @@ "message_id": "友言uid", "message_id_placeholder": "申请的uid", "save": "保存修改", - "editor": "默认文章编辑器" + "editor": "默认文章编辑器", + "author_name": "网站所有者", + "author_name_placeholder": "网站所有者", + "email_addr": "邮箱", + "email_addr_placeholder": "邮件地址" } } } \ No newline at end of file diff --git a/public/css/posts_style_custom.css b/public/css/posts_style_custom.css new file mode 100644 index 0000000..874742d --- /dev/null +++ b/public/css/posts_style_custom.css @@ -0,0 +1,21 @@ +.post-copyright { + position: relative; + margin-bottom: 1rem; + padding: .5rem .8rem; + border: 1px solid #eee; + -webkit-transition: box-shadow .3s ease-in-out; + -moz-transition: box-shadow .3s ease-in-out; + -o-transition: box-shadow .3s ease-in-out; + -ms-transition: box-shadow .3s ease-in-out; + transition: box-shadow .3s ease-in-out; +} +.post-copyright::before { + position: absolute; + top: .5rem; + right: .5rem; + width: .8rem; + height: .8rem; + border-radius: .8rem; + background: #49b1f5; + content: ""; +} \ No newline at end of file diff --git a/routes/admin.js b/routes/admin.js index cee67e0..49f8141 100644 --- a/routes/admin.js +++ b/routes/admin.js @@ -550,6 +550,7 @@ router.post('/saveSettings', (req, res, next) => { LogoPath: req.body.LogoPath, PageSize: req.body.PageSize, ExpandMenu: req.body.ExpandMenu, + ShowArticleSign:req.body.ShowArticleSign, Editor: req.body.Editor, CacheExpired: req.body.CacheExpired, TranslateKey: req.body.TranslateKey, @@ -560,7 +561,9 @@ router.post('/saveSettings', (req, res, next) => { ShowComments: req.body.ShowComments, ShowGuestbook: req.body.ShowGuestbook, ChangyanId: req.body.ChangyanId, - ChangyanConf: req.body.ChangyanConf + ChangyanConf: req.body.ChangyanConf, + Email:req.body.EmailAddr, + Author:req.body.AuthorName }); res.end(); }); diff --git a/views/admin/settings.pug b/views/admin/settings.pug index f8ec9fe..65408ed 100644 --- a/views/admin/settings.pug +++ b/views/admin/settings.pug @@ -93,6 +93,16 @@ block content button.btn.btn-white.spinbox-down.btn-xs(type='button') span.fa.fa-chevron-down span.sr-only Decrease + li.list-group-item.clearfix + .pull-left + | #{__("admin.settings.author_name")} + .pull-right + input#AuthorName.form-control(type='text', name='AuthorName', placeholder=__("admin.settings.author_name_placeholder"), value=settings.Author) + li.list-group-item.clearfix + .pull-left + | #{__("admin.settings.email_addr")} + .pull-right + input#EmailAddr.form-control(type='text', name='EmailAddr', placeholder=__("admin.settings.email_addr_placeholder"), value=settings.Email) .col-md-6(style='margin-bottom:10px;') .panel.panel-default #headingComponent.panel-heading(role='tab') @@ -159,6 +169,12 @@ block content | #{__("admin.settings.comments_conf")} .pull-right input#ChangyanConf.form-control(type='text', name='ChangyanConf', placeholder=__("admin.settings.comments_conf_placeholder"), value=settings.ChangyanConf) + li.list-group-item.clearfix + .pull-left + | #{__("admin.settings.show_article_sign")} + .pull-right + input#ShowArticleSign(type='hidden', name='ShowArticleSign', value=settings.ShowArticleSign) + input.js-switch(type='checkbox', checked=settings.ShowArticleSign === 'true') .row .col-lg-12 diff --git a/views/blog/article.pug b/views/blog/article.pug index 3571fac..b7da6cb 100644 --- a/views/blog/article.pug +++ b/views/blog/article.pug @@ -3,6 +3,8 @@ block content link(href='/static/css/animate-custom.css', rel='stylesheet') link(href='https://cdn.bootcss.com/highlight.js/9.12.0/styles/github.min.css', rel='stylesheet') link(href='/static/lightbox2/dist/css/lightbox.min.css', rel='stylesheet') + link(href='/static/css/posts_style_custom.css', rel='stylesheet') + if (post.ContentType === 'markdown') link(href='/static/css/github-markdown.css', rel='stylesheet') .detail-container @@ -36,6 +38,9 @@ block content span=':' + post.Summary div(class=`${post.ContentType === 'markdown' ? 'markdown-body' : 'normal-body'}`) !=resultContent + .copyright(style=`${settings.ShowArticleSign === "true" ? "display: block;" : "display: none;"}`) + .clearfix + include ../shared/artical_footer if(settings.ShowComments === 'true') hr.hr-article #SOHUCS(sid=post.UniqueId) diff --git a/views/shared/artical_footer.pug b/views/shared/artical_footer.pug new file mode 100644 index 0000000..9e84de1 --- /dev/null +++ b/views/shared/artical_footer.pug @@ -0,0 +1,33 @@ +p + br +p(style="max-width: 100%; min-height: 1em; color: rgb(62, 62, 62); font-size: 16px; white-space: normal; font-family: 微软雅黑; text-align: center; line-height: 1.75em; box-sizing: border-box !important; word-wrap: break-word !important;") + span(style="letter-spacing: 1px;") + strong + span(style="font-size: 14px;") 【END】 +p(style="max-width: 100%; min-height: 1em; color: rgb(62, 62, 62); font-size: 16px; white-space: normal; font-family: 微软雅黑; text-align: center; line-height: 1.75em; box-sizing: border-box !important; word-wrap: break-word !important;") + span(style="letter-spacing: 1px;") + strong + span(style="font-size: 14px;") + br + +.post-copyright(style="max-width: 100%; min-height: 1em; color: rgb(62, 62, 62); font-size: 16px; white-space: normal; font-family: 微软雅黑; line-height: 1.75em; box-sizing: border-box !important; word-wrap: break-word !important;") + .post-copyright__author + span.post-copyright-meta Author: + span.post-copyright-info + a(href="mailto:@config.Email") #{settings.Author} + .post-copyright__type + span.post-copyright-meta 文章链接: + span.post-copyright-info + a#declaration_url + .post-copyright__notice + span + .class("post-copyright-meta") 版权声明: 本博客所有文章除声明转载外,均采用 + a(href="https://creativecommons.org/licenses/by-nc-sa/3.0/deed.zh" target="_blank") CC BY-NC-SA 3.0 + | 许可协议。转载请注明来自 + a(href="http://"+settings.SiteDomain target="_blank") #{settings.SiteName} ! + +script. + url=window.location.href + console.log(url) + document.getElementById("declaration_url").innerHTML=url; + document.getElementById("declaration_url").href=url; \ No newline at end of file