Skip to content

Commit

Permalink
🎨 b3log#151 for Next
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Nov 1, 2018
1 parent 29feb1f commit 102daed
Show file tree
Hide file tree
Showing 18 changed files with 29,322 additions and 14 deletions.
2 changes: 2 additions & 0 deletions theme/comment/comments.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{define "comment/comments"}}
<div id="pipeCommentsWrap">
{{if gt (len .Comments) 0}}
<div id="pipeComments" class="fn-clear"
data-title="{{.I18n.Comment}}{{.I18n.Colon}}{{.Article.Title}}"
Expand Down Expand Up @@ -46,4 +47,5 @@
{{.I18n.StayStep}}
</div>
{{end}}
</div>
{{end}}
12 changes: 6 additions & 6 deletions theme/js/article.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,13 @@ export const InitComment = () => {
})

// bottom reply
$('#pipeComments').on('click', '#pipeCommentBottomComment', function () {
$('#pipeCommentsWrap').on('click', '#pipeCommentBottomComment', function () {
const $bottomComment = $(this)
ShowEditor($bottomComment.data('text'), $bottomComment.data('id'))
})

// comment show reply
$('#pipeComments').on('click', '.fn-pointer', function () {
$('#pipeCommentsWrap').on('click', '#pipeComments .fn-pointer', function () {
const $it = $(this)
if ($it.hasClass('disabled')) {
return
Expand Down Expand Up @@ -223,8 +223,8 @@ export const InitComment = () => {
})

// comment remove
$('#pipeComments').
on('click', '.pipe-comment__btn--danger', function () {
$('#pipeCommentsWrap').
on('click', '#pipeComments .pipe-comment__btn--danger', function () {
const $it = $(this)
if (confirm($it.data('label'))) {
$.ajax({
Expand Down Expand Up @@ -255,8 +255,8 @@ ${$it.data('label2')}`).click(function () {
})

// comment reply
$('#pipeComments').
on('click', '.pipe-comment__btn--reply', function () {
$('#pipeCommentsWrap').
on('click', '#pipeComments .pipe-comment__btn--reply', function () {
const $it = $(this)
ShowEditor($it.data('title'), $it.data('id'), $it.data('commentid'))
})
Expand Down
2 changes: 1 addition & 1 deletion theme/x/Medium/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @fileoverview util and every page should be used.
*
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @version 0.3.0.0, Dec 1, 2018
* @version 0.3.0.0, Nov 1, 2018
*/

import $ from 'jquery'
Expand Down
6 changes: 6 additions & 0 deletions theme/x/Next/archive-articles.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<body>
<div class="main">
{{template "Next/header" .}}
<div id="pjax">
{{if .pjax}}{{noescape "<!---- pjax {#pjax} start ---->"}}{{end}}
<div class="wrapper">
<h2 class="page__articles">
{{.Archive.Title}}
Expand All @@ -16,11 +18,15 @@ <h2 class="page__articles">
{{template "Next/article-list" .}}
</div>
{{template "Next/side" .}}
{{if .pjax}}{{noescape "<!---- pjax {#pjax} end ---->"}}{{end}}
</div>
{{template "Next/footer" .}}
</div>
{{if .pjax}}{{noescape "<!---- pjax {#pjax} start ---->"}}{{end}}
<script>
increase({{.Archive.ArticleCount}}, 1000, 'archiveArticleCount', 0)
</script>
{{if .pjax}}{{noescape "<!---- pjax {#pjax} end ---->"}}{{end}}
</body>
</html>
{{end}}
6 changes: 6 additions & 0 deletions theme/x/Next/archives.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<body>
<div class="main">
{{template "Next/header" .}}
<div id="pjax">
{{if .pjax}}{{noescape "<!---- pjax {#pjax} start ---->"}}{{end}}
<div class="wrapper page">
<h2 class="page__title">
<span id="archiveMonthCount">0</span> <span class="ft-fade ft-13">{{.I18n.Month2}}</span>
Expand All @@ -21,12 +23,16 @@ <h2 class="page__title">
{{end}}
</div>
{{template "Next/side" .}}
{{if .pjax}}{{noescape "<!---- pjax {#pjax} end ---->"}}{{end}}
</div>
{{template "Next/footer" .}}
</div>
{{if .pjax}}{{noescape "<!---- pjax {#pjax} start ---->"}}{{end}}
<script>
increase({{len .Archives}}, 1000, 'archiveMonthCount', 0)
increase({{.Statistic.StatisticArticleCount}}, 1000, 'archiveArticleCount', 0)
</script>
{{if .pjax}}{{noescape "<!---- pjax {#pjax} end ---->"}}{{end}}
</body>
</html>
{{end}}
4 changes: 4 additions & 0 deletions theme/x/Next/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
<body>
<div class="main">
{{template "Next/header" .}}
<div id="pjax">
{{if .pjax}}{{noescape "<!---- pjax {#pjax} start ---->"}}{{end}}
<div class="wrapper">
<article class="article__item">
<header class="article__header article__header--center">
Expand Down Expand Up @@ -151,6 +153,8 @@ <h2>
{{end}}
{{template "comment/editor" .}}
{{template "Next/side" .}}
{{if .pjax}}{{noescape "<!---- pjax {#pjax} end ---->"}}{{end}}
</div>
{{template "Next/footer" .}}
</div>
</body>
Expand Down
6 changes: 6 additions & 0 deletions theme/x/Next/author-articles.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<body>
<div class="main">
{{template "Next/header" .}}
<div id="pjax">
{{if .pjax}}{{noescape "<!---- pjax {#pjax} start ---->"}}{{end}}
<div class="wrapper">
<h2 class="page__articles">
{{.Author.Name}}
Expand All @@ -16,11 +18,15 @@ <h2 class="page__articles">
{{template "Next/article-list" .}}
</div>
{{template "Next/side" .}}
{{if .pjax}}{{noescape "<!---- pjax {#pjax} end ---->"}}{{end}}
</div>
{{template "Next/footer" .}}
</div>
{{if .pjax}}{{noescape "<!---- pjax {#pjax} start ---->"}}{{end}}
<script>
increase({{.Author.ArticleCount}}, 1000, 'authorCount', 0)
</script>
{{if .pjax}}{{noescape "<!---- pjax {#pjax} end ---->"}}{{end}}
</body>
</html>
{{end}}
6 changes: 6 additions & 0 deletions theme/x/Next/authors.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<body>
<div class="main">
{{template "Next/header" .}}
<div id="pjax">
{{if .pjax}}{{noescape "<!---- pjax {#pjax} start ---->"}}{{end}}
<div class="wrapper">
<h2 class="page__articles">
<span id="authorCount">0</span> <span class="ft-fade ft-13">{{.I18n.TeamMember2}}</span>
Expand All @@ -25,11 +27,15 @@ <h3 class="author__name">{{.Name}}</h3>
</div>
</div>
{{template "Next/side" .}}
{{if .pjax}}{{noescape "<!---- pjax {#pjax} end ---->"}}{{end}}
</div>
{{template "Next/footer" .}}
</div>
{{if .pjax}}{{noescape "<!---- pjax {#pjax} start ---->"}}{{end}}
<script>
increase({{len .Authors}}, 1000, 'authorCount', 0)
</script>
{{if .pjax}}{{noescape "<!---- pjax {#pjax} end ---->"}}{{end}}
</body>
</html>
{{end}}
6 changes: 6 additions & 0 deletions theme/x/Next/categories.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
<body>
<div class="main">
{{template "Next/header" .}}
<div id="pjax">
{{if .pjax}}{{noescape "<!---- pjax {#pjax} start ---->"}}{{end}}
<div class="wrapper page">
<h2 class="page__title">
<span id="categoriesCount">0</span> <span class="ft-fade ft-13">{{.I18n.Categories2}}</span>
Expand All @@ -32,11 +34,15 @@ <h3>
{{end}}
</div>
{{template "Next/side" .}}
{{if .pjax}}{{noescape "<!---- pjax {#pjax} end ---->"}}{{end}}
</div>
{{template "Next/footer" .}}
</div>
{{if .pjax}}{{noescape "<!---- pjax {#pjax} start ---->"}}{{end}}
<script>
increase({{len .Categories}}, 1000, 'categoriesCount', 0)
</script>
{{if .pjax}}{{noescape "<!---- pjax {#pjax} end ---->"}}{{end}}
</body>
</html>
{{end}}
6 changes: 6 additions & 0 deletions theme/x/Next/category-articles.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<body>
<div class="main">
{{template "Next/header" .}}
<div id="pjax">
{{if .pjax}}{{noescape "<!---- pjax {#pjax} start ---->"}}{{end}}
<div class="wrapper">
<h2 class="page__articles">
{{.Category.Title}}
Expand All @@ -16,11 +18,15 @@ <h2 class="page__articles">
{{template "Next/article-list" .}}
</div>
{{template "Next/side" .}}
{{if .pjax}}{{noescape "<!---- pjax {#pjax} end ---->"}}{{end}}
</div>
{{template "Next/footer" .}}
</div>
{{if .pjax}}{{noescape "<!---- pjax {#pjax} start ---->"}}{{end}}
<script>
increase({{.Category.ArticleCount}}, 1000, 'categoryArticleCount', 0)
</script>
{{if .pjax}}{{noescape "<!---- pjax {#pjax} end ---->"}}{{end}}
</body>
</html>
{{end}}
2 changes: 1 addition & 1 deletion theme/x/Next/css/common.css

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions theme/x/Next/css/common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ a:hover {
.header {
background: #f5f5f5;
margin-bottom: 80px;
padding: 40px 0;
padding: 40px 0 20px;

&__logo {
position: relative;
Expand All @@ -417,6 +417,7 @@ a:hover {
border-bottom-width: 0;
color: #222;
float: left;
margin-bottom: 20px;

div {
opacity: 0;
Expand Down Expand Up @@ -929,7 +930,7 @@ a:hover {

@media (max-width: 768px) {
.header {
padding: 20px 0;
padding: 20px 0 0;
margin-bottom: 20px;
nav {
display: none;
Expand Down
4 changes: 4 additions & 0 deletions theme/x/Next/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@
<body>
<div class="main">
{{template "Next/header" .}}
<div id="pjax">
{{if .pjax}}{{noescape "<!---- pjax {#pjax} start ---->"}}{{end}}
<div class="wrapper">
{{template "Next/article-list" .}}
</div>
{{template "Next/side" .}}
{{if .pjax}}{{noescape "<!---- pjax {#pjax} end ---->"}}{{end}}
</div>
{{template "Next/footer" .}}
</div>
</body>
Expand Down
17,421 changes: 17,420 additions & 1 deletion theme/x/Next/js/article.min.js

Large diffs are not rendered by default.

20 changes: 18 additions & 2 deletions theme/x/Next/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @fileoverview util and every page should be used.
*
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @version 0.2.0.0, Oct 11, 2018
* @version 0.3.0.0, Nov 1, 2018
*/

import $ from 'jquery'
Expand All @@ -12,6 +12,7 @@ import {
KillBrowser,
PreviewImg,
} from '../../../js/common'
import config from '../../../../pipe.json'

const Common = {
/**
Expand All @@ -20,7 +21,22 @@ const Common = {
init: () => {
PreviewImg()
KillBrowser()
initPjax('Next')
initPjax(() => {
if ($('#pipeComments').length === 1) {
$.ajax({
method: 'GET',
url: `${config.StaticServer}/theme/x/Next/js/article.min.js`,
dataType: 'script',
cache: true,
})
}

if ($('#pipeComments').length !== 1 || $('#toc').length !== 1) {
$('#sideBar').removeClass('sidebar--active')
$('.main').css('margin-right', '0')
$('.side').removeClass('side--active')
}
})
$('#sideBar').click(function () {
if ($(this).hasClass('sidebar--active')) {
$(this).removeClass('sidebar--active')
Expand Down
11,816 changes: 11,815 additions & 1 deletion theme/x/Next/js/common.min.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions theme/x/Next/tag-articles.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<body>
<div class="main">
{{template "Next/header" .}}
<div id="pjax">
{{if .pjax}}{{noescape "<!---- pjax {#pjax} start ---->"}}{{end}}
<div class="wrapper">
<h2 class="page__articles">
{{.Tag.Title}}
Expand All @@ -16,11 +18,15 @@ <h2 class="page__articles">
{{template "Next/article-list" .}}
</div>
{{template "Next/side" .}}
{{if .pjax}}{{noescape "<!---- pjax {#pjax} end ---->"}}{{end}}
</div>
{{template "Next/footer" .}}
</div>
{{if .pjax}}{{noescape "<!---- pjax {#pjax} start ---->"}}{{end}}
<script>
increase({{.Tag.ArticleCount}}, 1000, 'tagArticlesCount', 0)
</script>
{{if .pjax}}{{noescape "<!---- pjax {#pjax} end ---->"}}{{end}}
</body>
</html>
{{end}}
6 changes: 6 additions & 0 deletions theme/x/Next/tags.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<body>
<div class="main">
{{template "Next/header" .}}
<div id="pjax">
{{if .pjax}}{{noescape "<!---- pjax {#pjax} start ---->"}}{{end}}
<div class="wrapper">
<h2 class="page__articles">
<span id="tagArticleCount">0</span> <span class="ft-fade ft-13">{{.I18n.Tags2}}</span>
Expand All @@ -22,12 +24,16 @@ <h2 class="page__articles">
</div>
</div>
{{template "Next/side" .}}
{{if .pjax}}{{noescape "<!---- pjax {#pjax} end ---->"}}{{end}}
</div>
{{template "Next/footer" .}}
</div>
{{if .pjax}}{{noescape "<!---- pjax {#pjax} start ---->"}}{{end}}
<script>
increase({{len .Tags}}, 1000, 'tagArticleCount', 0)
addLevelToTag()
</script>
{{if .pjax}}{{noescape "<!---- pjax {#pjax} end ---->"}}{{end}}
</body>
</html>
{{end}}

0 comments on commit 102daed

Please sign in to comment.