Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/2.0.0-dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Mar 5, 2017
2 parents f043cfe + f086ace commit 1757167
Show file tree
Hide file tree
Showing 17 changed files with 208 additions and 181 deletions.
6 changes: 4 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.5.3.2, Mar 1, 2017
* @version 1.6.3.2, Mar 5, 2017
*/

'use strict';
Expand Down Expand Up @@ -91,7 +91,9 @@ gulp.task('build', ['sass', 'clean'], function () {
'./src/main/webapp/js/lib/reconnecting-websocket.min.js',
'./src/main/webapp/js/lib/jquery/jquery.bowknot.min.js',
'./src/main/webapp/js/lib/ua-parser.min.js',
'./src/main/webapp/js/lib/jquery/jquery.hotkeys.js'];
'./src/main/webapp/js/lib/jquery/jquery.hotkeys.js',
'./src/main/webapp/js/lib/jquery/jquery.pjax.js',
'./src/main/webapp/js/lib/nprogress/nprogress.js'];
gulp.src(jsCommonLib)
.pipe(uglify())
.pipe(concat('libs.min.js'))
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/css/base.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/main/webapp/css/index.css

Large diffs are not rendered by default.

47 changes: 45 additions & 2 deletions src/main/webapp/js/article.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.28.42.30, Mar 1, 2017
* @version 1.28.42.31, Mar 5, 2017
*/

/**
Expand Down Expand Up @@ -288,6 +288,22 @@ var Comment = {

this._initHotKey();

$.pjax({
selector: '.pagination a',
container: '#comments',
show: '',
cache: false,
storage: true,
titleSuffix: ''
});
NProgress.configure({ showSpinner: false });
$('#comments').bind('pjax.start', function(){
NProgress.start();
});
$('#comments').bind('pjax.end', function(){
NProgress.done();
});

if (!Label.isLoggedIn) {
return false;
}
Expand Down Expand Up @@ -931,6 +947,14 @@ var Article = {
});

this.initToc();

if (Label.isLoggedIn) {
Article.makeNotificationRead(Label.articleOId, Label.notificationCmtIds);

setTimeout(function() {
Util.setUnreadNotificationCount();
}, 1000);
}
},
/**
* 历史版本对比
Expand Down Expand Up @@ -1462,4 +1486,23 @@ var Article = {
}
};

Article.init();
Article.init();

$(document).ready(function () {
Comment.init();
// jQuery File Upload
Util.uploadFile({
"type": "img",
"id": "fileUpload",
"pasteZone": $(".CodeMirror"),
"qiniuUploadToken": Label.qiniuUploadToken,
"editor": Comment.editor,
"uploadingLabel": Label.uploadingLabel,
"qiniuDomain": Label.qiniuDomain,
"imgMaxSize": Label.imgMaxSize,
"fileMaxSize": Label.fileMaxSize
});

// Init [Article] channel
ArticleChannel.init(Label.articleChannel);
});
2 changes: 1 addition & 1 deletion src/main/webapp/js/article.min.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/main/webapp/js/lib/compress/libs.min.js

Large diffs are not rendered by default.

88 changes: 85 additions & 3 deletions src/main/webapp/js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author Zephyr
* @version 1.20.11.17, Feb 18, 2017
* @version 1.20.11.18, Mar 5, 2017
*/

/**
Expand All @@ -33,9 +33,22 @@ var Settings = {
* 个人主页滚动固定
*/
homeScroll: function () {
var beforeScorllTop = $(window).scrollTop(),
navHTML = $('.nav-tabs').html();

$(window).scroll(function () {
var currentScrollTop = $(window).scrollTop();
if (currentScrollTop > beforeScorllTop) {
$('.nav-tabs').html($('.home-menu').html());
} else {
$('.nav-tabs').html(navHTML);
}

beforeScorllTop = currentScrollTop;
});

$('.nav').css('position', 'fixed');
$('.main').css('paddingTop', '89px');
$('.nav-tabs').html($('.home-menu').html()).css('text-align', 'left');
},
/**
* 通知页面侧边栏滚动固定
Expand Down Expand Up @@ -679,5 +692,74 @@ var Settings = {
$("#emotionList").val(emoji);
}
});
},
/**
* 个人主页初始化
*/
initHome: function () {
if (Label.type === 'commentsAnonymous' || 'comments' === Label.type) {
Settings.initHljs();
}
if (Label.type === 'linkForge') {
Util.linkForge();
}

if ($.ua.device.type !== 'mobile') {
Settings.homeScroll();
}

$.pjax({
selector: 'a',
container: '#home-pjax-container',
show: '',
cache: false,
storage: true,
titleSuffix: '',
filter: function(href){
return 0 > href.indexOf(Label.servePath + '/member/' + Label.userName);
},
callback: function(status){
switch(status.type){
case 'success':
case 'cache':
$('.nav-tabs a').removeClass('current');
switch (this.pathname) {
case '/member/' + Label.userName:
case '/member/' + Label.userName + '/comments':
Settings.initHljs();
case '/member/' + Label.userName + '/articles/anonymous':
case '/member/' + Label.userName + '/comments/anonymous':
Settings.initHljs();
$($('.nav-tabs a')[0]).addClass('current');
break;
case '/member/' + Label.userName + '/watching/articles':
case '/member/' + Label.userName + '/following/users':
case '/member/' + Label.userName + '/following/tags':
case '/member/' + Label.userName + '/following/articles':
case '/member/' + Label.userName + '/followers':
$($('.nav-tabs a')[1]).addClass('current');
break;
case '/member/' + Label.userName + '/points':
$($('.nav-tabs a')[2]).addClass('current');
break;
case '/member/' + Label.userName + '/forge/link':
$($('.nav-tabs a')[3]).addClass('current');
Util.linkForge();
break;
}
case 'error':
break;
case 'hash':
break;
}
}
});
NProgress.configure({ showSpinner: false });
$('#home-pjax-container').bind('pjax.start', function(){
NProgress.start();
});
$('#home-pjax-container').bind('pjax.end', function(){
NProgress.done();
});
}
};
};
2 changes: 1 addition & 1 deletion src/main/webapp/js/settings.min.js

Large diffs are not rendered by default.

25 changes: 22 additions & 3 deletions src/main/webapp/scss/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 2.28.21.56, Feb 28, 2017
* @version 2.29.21.56, Mar 5, 2017
*/

@import "variables";
Expand Down Expand Up @@ -1636,11 +1636,11 @@ a[class*=" icon-"]:hover {
position: relative;

h2 > a {
color: #666;
color: #333;
}

h2 > a:hover {
color: #333;
color: #000;
}
}

Expand Down Expand Up @@ -2109,3 +2109,22 @@ ul.CodeMirror-hints {
}
}
/* end algolia */

/* start nprogress */
/* Make clicks pass-through */
#nprogress {
pointer-events: none;
}

#nprogress .bar {
background: #d23f31;

position: fixed;
z-index: 1031;
top: 0;
left: 0;

width: 100%;
height: 2px;
}
/* end nprogress */
3 changes: 2 additions & 1 deletion src/main/webapp/scss/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 2.25.21.50, Mar 1, 2017
* @version 2.25.21.51, Mar 5, 2017
*/

@import "variables";
Expand Down Expand Up @@ -471,6 +471,7 @@ label.cmt-anonymous {

ul > li > h2 > a {
font-size: 18px;
font-weight: 700;
}

ul > li:hover .fn-hidden {
Expand Down
61 changes: 10 additions & 51 deletions src/main/webapp/skins/classic/article.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<#include "header.ftl">
<div class="main">
<div class="wrapper">
<div class="content" id="article-pjax-container"><#if pjax><!---- pjax {#article-pjax-container} start ----></#if>
<div class="content">
<div class="module">
<div class="article-module">
<h1 class="article-title" itemprop="name">
Expand Down Expand Up @@ -284,7 +284,7 @@
</div>
</div>
</#if>

<#if pjax><!---- pjax {#comments} start ----></#if>
<div class="module comments" id="comments">
<div class="comments-header module-header">
<span class="article-cmt-cnt">${article.articleCommentCount} ${cmtLabel}</span>
Expand Down Expand Up @@ -317,6 +317,7 @@
</div>
<@pagination url="${servePath}${article.articlePermalink}" query="m=${userCommentViewMode}#comments" pjaxTitle="${article.articleTitle} - ${symphonyLabel}" />
</div>
<#if pjax><!---- pjax {#comments} end ----></#if>

<div class="ft-center fn-pointer <#if article.articleComments?size == 0> fn-none</#if>" title="${cmtLabel}"
<#if permissions["commonAddComment"].permissionGrant>
Expand Down Expand Up @@ -352,7 +353,6 @@
</div>
</div>
</#if>
<#if pjax><!---- pjax {#article-pjax-container} end ----></#if>
</div>
<div class="side">
<#include 'common/person-info.ftl'/>
Expand Down Expand Up @@ -446,9 +446,6 @@
<script src="${staticServePath}/js/lib/compress/article-libs.min.js?${staticResourceVersion}"></script>
<script src="${staticServePath}/js/article${miniPostfix}.js?${staticResourceVersion}"></script>
<script src="${staticServePath}/js/channel${miniPostfix}.js?${staticResourceVersion}"></script>
<script src="${staticServePath}/js/lib/jquery/jquery.pjax.js?${staticResourceVersion}"></script>
<script src='${staticServePath}/js/lib/nprogress/nprogress.js?${staticResourceVersion}'></script>
<link rel='stylesheet' href='${staticServePath}/js/lib/nprogress/nprogress.css?${staticResourceVersion}'/>
<script>
Label.commentErrorLabel = "${commentErrorLabel}";
Label.symphonyLabel = "${symphonyLabel}";
Expand Down Expand Up @@ -483,54 +480,16 @@
Label.qiniuDomain = '${qiniuDomain}';
Label.qiniuUploadToken = '${qiniuUploadToken}';
Label.noPermissionLabel = '${noPermissionLabel}';
Label.imgMaxSize = ${imgMaxSize?c};
Label.fileMaxSize = ${fileMaxSize?c};
Label.articleChannel = "${wsScheme}://${serverHost}:${serverPort}${contextPath}/article-channel?articleId=${article.oId}&articleType=${article.articleType}";
<#if isLoggedIn>
Label.currentUserName = '${currentUser.userName}';
Article.makeNotificationRead('${article.oId}', '${notificationCmtIds}');
setTimeout(function() {
Util.setUnreadNotificationCount();
}, 1000);
Label.notificationCmtIds = '${notificationCmtIds}';
</#if>
<#if 3 == article.articleType>
Article.playThought('${article.articleContent}');
</#if>
// Init [Article] channel
ArticleChannel.init("${wsScheme}://${serverHost}:${serverPort}${contextPath}/article-channel?articleId=${article.oId}&articleType=${article.articleType}");
$(document).ready(function () {
Comment.init();
// jQuery File Upload
Util.uploadFile({
"type": "img",
"id": "fileUpload",
"pasteZone": $(".CodeMirror"),
"qiniuUploadToken": "${qiniuUploadToken}",
"editor": Comment.editor,
"uploadingLabel": "${uploadingLabel}",
"qiniuDomain": "${qiniuDomain}",
"imgMaxSize": ${imgMaxSize?c},
"fileMaxSize": ${fileMaxSize?c}
});
<#if 3 == article.articleType>
Article.playThought('${article.articleContent}');
</#if>
});
$.pjax({
selector: 'a',
container: '#article-pjax-container',
show: '',
cache: false,
storage: true,
titleSuffix: '',
filter: function(href){
return 0 > href.indexOf('${servePath}/article/');
},
callback: function(){}
});
NProgress.configure({ showSpinner: false });
$('#article-pjax-container').bind('pjax.start', function(){
NProgress.start();
});
$('#article-pjax-container').bind('pjax.end', function(){
NProgress.done();
});
</script>
</body>
</html>
3 changes: 0 additions & 3 deletions src/main/webapp/skins/classic/domain-articles.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@
</div>
<#include "footer.ftl">
<@listScript/>
<script src="${staticServePath}/js/lib/jquery/jquery.pjax.js?${staticResourceVersion}"></script>
<script src='${staticServePath}/js/lib/nprogress/nprogress.js?${staticResourceVersion}'></script>
<link rel='stylesheet' href='${staticServePath}/js/lib/nprogress/nprogress.css?${staticResourceVersion}'/>
<script>
$.pjax({
selector: 'a',
Expand Down
Loading

0 comments on commit 1757167

Please sign in to comment.