Skip to content

Commit

Permalink
Merge pull request #243 from xzhuz/dev
Browse files Browse the repository at this point in the history
🚑 Hotfix: 修复分页插件,修复列表日期展示
  • Loading branch information
xzhuz authored Apr 7, 2022
2 parents 4d69a28 + 7ee7f9a commit 0830ac3
Show file tree
Hide file tree
Showing 18 changed files with 223 additions and 64 deletions.
2 changes: 1 addition & 1 deletion dist/style.css

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions module/pjax.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@
// 图片懒加载
xueContext.lazyloadImage()
// 随机卡片颜色
xueContext.randomBadgeColor()
//重载
if (typeof _hmt !== 'undefined') {
// support 百度统计
Expand Down
3 changes: 3 additions & 0 deletions module/plugins.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
<#--相册-->
<script src="${theme_base!}/source/js/plugins/isotope.pkgd.min.js"></script>

<#--相册-->
<script src="${theme_base!}/source/js/plugins/clipboard.min.js"></script>

<#--导航栏-->
<script src="${theme_base!}/source/js/plugins/simply-nav.js"></script>

Expand Down
12 changes: 7 additions & 5 deletions module/widget/pagination.ftl
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<ul class="pagination-list flex flex-row " id="pagination">
<li class="pagination-previous<#if pagination.hasPrev><#else > is-invisible </#if>">
<span class="pagination-circle" data-path="${pagination.prevPageFullPath!}" >
<span class="iconfont icon-left dark:text-gray-300"> </span>
<#if pagination.hasPrev>
<li class="pagination-previous">
<span class="pagination-circle iconfont icon-left dark:text-gray-300" data-path="${pagination.prevPageFullPath!}" >
<#-- <span class="iconfont icon-left dark:text-gray-300"></span>-->
</span>
</li>
</#if>
<#list pagination.rainbowPages as number>
<#if number.isCurrent>
<li>
Expand All @@ -18,8 +20,8 @@
</#list>
<#if pagination.hasNext>
<li class="pagination-next">
<span class="pagination-circle dark:text-gray-300" data-path="${pagination.nextPageFullPath!}" >
<span class="iconfont icon-right dark:text-gray-300"> </span>
<span class="pagination-circle iconfont icon-right dark:text-gray-300" data-path="${pagination.nextPageFullPath!}" >
<#-- <span class="iconfont icon-right dark:text-gray-300"> </span>-->
</span>
</li>
</#if>
Expand Down
2 changes: 1 addition & 1 deletion module/widget/post_list.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<span class=" text-xs mr-1 text-gray-500 inline-block md:hidden">${post.commentCount!} </span>
<span class="iconfont icon-round_like_fill text-xs mr-1 text-gray-500 inline-block md:hidden"></span>
<span class=" text-xs mr-1 text-gray-500 inline-block md:hidden">${post.likes!} </span>
<span class="text text-gray-500 uppercase text-sm ml-auto tracking-wide hidden md:inline-block">${post.createTime?string("yyyy-MM-dd hh:mm")}</span>
<span class="text text-gray-500 uppercase text-sm ml-auto tracking-wide hidden md:inline-block">${post.createTime?string("yyyy-MM-dd HH:mm")}</span>
<span class="text text-gray-500 uppercase text-xs ml-auto tracking-wide inline-block md:hidden">${post.createTime?string("yyyy-MM")}</span>
</div>
</div>
Expand Down
33 changes: 12 additions & 21 deletions source/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ const xueContext = {
if ($("#container").find('#toc').length < 1) {
return
}
wrapHeader();
// 不用生成随机 id 的方式,新版本的 tocbot 能够解决锚点的问题
// wrapHeader();
const headerEl = "h1,h2,h3,h4,h5,h6", //headers
content = ".md-content"; //文章容器
tocbot.init({
Expand Down Expand Up @@ -271,7 +272,6 @@ const xueContext = {
xueContext.lazyloadImage()
xueContext.pageBtn();
xueContext.reveal();
xueContext.randomBadgeColor();
},
error: function () {
$(pageContainer).empty();
Expand Down Expand Up @@ -426,18 +426,7 @@ const xueContext = {
}
},

// 随机徽章颜色
randomBadgeColor: function () {
// document.querySelectorAll('.badge').forEach(e => {
// var text = $(e).find('span').attr('data-value')
// var randomColor = Math.floor(text.hashCode() * 0xFFFFF).toString(16);
// randomColor = randomColor && randomColor.length > 6 ? randomColor.substr(0, 6) : randomColor
// $(e).find('i').removeClass('bg-red-400').attr('style', 'background-color: #' + randomColor);
// $(e).find('span').removeClass('text-red-400').attr('style', 'color: #' + randomColor);
//
// })
},


// 计算时间
createTimeAgo() {
document.querySelectorAll('.time-ago').forEach(e => {
Expand All @@ -447,8 +436,7 @@ const xueContext = {
$e.html(time)
})
},



// 相册页面
gallery: function () {
const $photoPage = $(".photos-page");
Expand Down Expand Up @@ -494,16 +482,19 @@ const xueContext = {
hljs.highlightBlock(el);
});

// 包裹代码块
wrapPreCode()

// 设置代码行号
xueContext.setCodeLineNumber();
},

// 设置代码行号
setCodeLineNumber: function () {
$('.md-content pre>code[class*="language-"]').each(function (i, block) {
lineNumbersBlock(block);
});


// 代码复制按钮
addCodeCopyBtn();
},


// 处理置顶
handleBack2Top: function () {
Expand Down
7 changes: 7 additions & 0 deletions source/js/plugins/clipboard.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0830ac3

Please sign in to comment.