Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release new version #258

Merged
merged 6 commits into from
Oct 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ body:
I made sure I checked
我确认我已经检查过了
options:
- label: I am using Keep version 3.8.1 or later.
- label: I am using Keep version 3.8.2 or later.
required: true
- label: I have already read the [Troubleshooting page of Hexo](https://hexo.io/docs/troubleshooting) and [Keep documents](https://keep-docs.xpoet.cn/tutorial/get-start/install-theme.html).
required: true
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ body:
I made sure I checked
我确认我已经检查过了
options:
- label: I am using Keep version 3.8.1 or later.
- label: I am using Keep version 3.8.2 or later.
required: true
- label: I have already read the [Troubleshooting page of Hexo](https://hexo.io/docs/troubleshooting) and [Keep documents](https://keep-docs.xpoet.cn/tutorial/get-start/install-theme.html).
required: true
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/other.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ body:
I made sure I checked
我确认我已经检查过了
options:
- label: I am using Keep version 3.8.1 or later.
- label: I am using Keep version 3.8.2 or later.
required: true
- label: I have already read the [Troubleshooting page of Hexo](https://hexo.io/docs/troubleshooting) and [Keep documents](https://keep-docs.xpoet.cn/tutorial/get-start/install-theme.html).
required: true
Expand Down
11 changes: 3 additions & 8 deletions layout/_partial/article-meta-info.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,10 @@ const home_tag_limit_number = theme?.home_article?.tag?.limit || 3

<% if (post.categories.length && (theme?.home_article?.category?.enable === true || page_type === 'post')) { %>
<span class="meta-info-item article-category border-box"><i class="icon fas fa-folder"></i>&nbsp;
<ul>
<ul class="article-category-ul">
<% post.categories.forEach((category, i) => {
if (home_category_limit_number === 0 || i + 1 <= home_category_limit_number || page_type === 'post') { %>
<li class="category-item">
<% if (i !== 0) { %>
<span class="category-separator"><i class="icon fas fa-angle-right"></i></span>
<% } %>
<a href="<%- url_for(category.path) %>"><%= category.name %></a>
</li>
<li class="category-item"><% if (i !== 0) { %>&nbsp;<i class="icon fas fa-angle-right"></i>&nbsp;<% } %><a href="<%- url_for(category.path) %>"><%= category.name %></a></li>
<% } %>
<% }) %>
</ul>
Expand All @@ -45,7 +40,7 @@ const home_tag_limit_number = theme?.home_article?.tag?.limit || 3
<% if (post.tags.length && (theme?.home_article?.tag?.enable === true || page_type === 'post')) { %>
<span class="article-tag meta-info-item border-box">
<i class="icon fas fa-tags"></i>&nbsp;
<ul>
<ul class="article-tag-ul">
<% post.tags.forEach((tag, i) => {
if (home_tag_limit_number === 0 || i + 1 <= home_tag_limit_number || page_type === 'post') { %>
<li class="tag-item"><span class="tag-separator"><i class="icon fas fa-hashtag"></i></span><a href="<%- url_for(tag.path) %>"><%= tag.name %></a></li>
Expand Down
1 change: 0 additions & 1 deletion layout/_partial/pjax/pjax.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
analytics: false,
currentUrlFullReload: false,
scrollRestoration: false,
scrollTo: true,
});

document.addEventListener('pjax:send', () => {
Expand Down
15 changes: 13 additions & 2 deletions layout/_partial/post/post-copyright-info.ejs
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
<%
let licenseLang = ''

if (config?.language === 'zh-CN') {
licenseLang = '.zh-hans'
}

if (config?.language === 'zh-TW') {
licenseLang = '.zh-hant'
}
%>
<div class="article-copyright-info-container border-box">
<div class="copyright-info-content border-box">
<div class="copyright-info-top border-box">
Expand All @@ -15,7 +26,7 @@
<div class="type">
<%- __('copyright.author') %>
</div>
<div class="content"><%= theme?.base_info?.author || config.author %></div>
<div class="content"><%= theme?.base_info?.author || config?.author || 'Anonymous' %></div>
</div>

<div class="post-time bottom-item">
Expand All @@ -31,7 +42,7 @@
<%- __('copyright.license') %>
</div>
<div class="content tooltip" data-tooltip-content="CC BY-NC-SA 4.0">
<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh">
<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed<%= licenseLang %>">
<i class="fa-brands fa-creative-commons"></i>
<i class="fa-brands fa-creative-commons-by"></i>
<i class="fa-brands fa-creative-commons-nc"></i>
Expand Down
24 changes: 7 additions & 17 deletions source/css/layout/_partial/article-meta-info.styl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$home-page-font-size = 0.92rem
$post-page-font-size = 0.86rem
$meta-icon-interspace = 0.3rem
$meta-icon-interspace = 0.4rem


.article-meta-info-container {
Expand Down Expand Up @@ -92,39 +92,28 @@ $meta-icon-interspace = 0.3rem


.article-category {
word-spacing -1rem
word-spacing 0

.category-item {

&:first-child {
margin-left $meta-icon-interspace
}

.category-separator {
margin 0 $meta-icon-interspace

i.icon {
font-size $home-page-font-size * 0.7
}
i.icon {
font-size $home-page-font-size * 0.7
}
}


+keep-mobile() {
display none !important
}
}


.article-tag {
word-spacing -1rem
word-spacing 0

.tag-item {
margin-right $meta-icon-interspace

&:first-child {
margin-left $meta-icon-interspace
}

&:last-child {
margin-right 0
}
Expand All @@ -138,6 +127,7 @@ $meta-icon-interspace = 0.3rem
}
}


+keep-tablet() {
display none !important
}
Expand Down
3 changes: 1 addition & 2 deletions source/js/code-block.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ KEEP.initCodeBlockTools = () => {
wrapper.appendChild(this)
}

const { style: codeCopyStyle } = KEEP.theme_config?.code_copy || {}
const { style: codeBlockStyle } = KEEP.theme_config?.code_block || {}
const { style: codeBlockToolsStyle } = KEEP.theme_config?.code_block?.tools || {}

const isMac = (codeCopyStyle || codeBlockStyle || codeBlockToolsStyle || 'default') === 'mac'
const isMac = (codeBlockStyle || codeBlockToolsStyle || 'default') === 'mac'
const foldedIconClassName = isMac ? 'fas fa-chevron-left' : 'fas fa-chevron-right'
const {
copy: copyLang,
Expand Down
2 changes: 1 addition & 1 deletion source/js/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* global KEEP */

window.addEventListener('DOMContentLoaded', () => {
const { version, local_search, code_block, code_copy, lazyload } = KEEP.theme_config
const { version, local_search, code_block, lazyload } = KEEP.theme_config

KEEP.themeInfo = {
theme: `Keep v${version}`,
Expand Down
4 changes: 2 additions & 2 deletions source/js/post/toc.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ function initTOC() {
element.addEventListener('click', (event) => {
event.preventDefault()
let winScrollY = window.scrollY
winScrollY = winScrollY === 0 ? -20 : winScrollY
winScrollY = winScrollY <= 1 ? -19 : winScrollY
const offset = target.getBoundingClientRect().top + winScrollY
window.anime({
targets: document.scrollingElement,
duration: 500,
easing: 'linear',
scrollTop: offset - 10,
scrollTop: offset,
complete: () => {
history.pushState(null, document.title, element.href)
setTimeout(() => {
Expand Down
58 changes: 34 additions & 24 deletions source/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ KEEP.initUtils = () => {
isHeaderTransparent: false,
hasToc: false,

// initialization data
initData() {
const { scroll, first_screen } = KEEP.theme_config?.style || {}
this.isHasScrollProgressBar = scroll?.progress_bar === true
Expand All @@ -33,7 +34,7 @@ KEEP.initUtils = () => {
}
},

// Scroll Style Handle
// scroll Style Handle
styleHandleWhenScroll() {
const scrollTop = document.body.scrollTop || document.documentElement.scrollTop
const scrollHeight = document.body.scrollHeight || document.documentElement.scrollHeight
Expand Down Expand Up @@ -267,6 +268,7 @@ KEEP.initUtils = () => {
return p2.replace(/%s/g, p1)
},

// get how long ago
getHowLongAgo(timestamp) {
const lang = KEEP.language_ago
const __Y = Math.floor(timestamp / (60 * 60 * 24 * 30) / 12)
Expand Down Expand Up @@ -294,6 +296,7 @@ KEEP.initUtils = () => {
}
},

// set how long age in home article block
setHowLongAgoInHome() {
const post = document.querySelectorAll('.article-meta-info .home-article-history')
post &&
Expand Down Expand Up @@ -574,6 +577,7 @@ KEEP.initUtils = () => {
})
},

// first screen typewriter
initTypewriter() {
const fsc = KEEP.theme_config?.style?.first_screen || {}
const isHitokoto = fsc?.hitokoto === true
Expand Down Expand Up @@ -619,42 +623,48 @@ KEEP.initUtils = () => {
isHitokoto ? 400 : 300
)
}
},

// remove white space between children
removeWhitespace(container) {
if (!container) {
return
}

const childNodes = container.childNodes
const whitespaceNodes = []

for (let i = 0; i < childNodes.length; i++) {
const node = childNodes[i]

if (node.nodeType === 3 && /^\s*$/.test(node.nodeValue)) {
whitespaceNodes.push(node)
}
}

for (const whitespaceNode of whitespaceNodes) {
container.removeChild(whitespaceNode)
}
},
trimPostMetaInfoBar() {
this.removeWhitespace(
document.querySelector('.article-meta-info-container .article-category-ul')
)
this.removeWhitespace(document.querySelector('.article-meta-info-container .article-tag-ul'))
}
}

// init data
KEEP.utils.initData()

// init scroll
KEEP.utils.registerWindowScroll()

// toggle show tools list
KEEP.utils.toggleShowToolsList()

// global font adjust
KEEP.utils.globalFontAdjust()

// check whether TOC exists
KEEP.utils.initHasToc()

// big image viewer handle
KEEP.utils.zoomInImage()

// set how long age in home article block
KEEP.utils.setHowLongAgoInHome()

// insert tooltip content dom
KEEP.utils.insertTooltipContent()

// busuanzi initialize
KEEP.utils.siteCountInitialize()

// page number jump handle
KEEP.utils.pageNumberJump()

// tabs active handle
KEEP.utils.tabsActiveHandle()

// first screen typewriter
KEEP.utils.initTypewriter()
KEEP.utils.trimPostMetaInfoBar()
}