diff --git a/_config.yml b/_config.yml index eb95739..48be3f5 100644 --- a/_config.yml +++ b/_config.yml @@ -751,6 +751,13 @@ note: # other # -------------------------------------- +# Artitalk +# see https://artitalk.js.org/ +artitalk: + appId: + appKey: + option: + # Pjax [Beta] # It may contain bugs and unstable, give feedback when you find the bugs. # https://github.com/MoOx/pjax @@ -910,3 +917,5 @@ CDN: prismjs_js: https://cdn.jsdelivr.net/npm/prismjs/prism.min.js prismjs_lineNumber_js: https://cdn.jsdelivr.net/npm/prismjs/plugins/line-numbers/prism-line-numbers.min.js prismjs_autoloader: https://cdn.jsdelivr.net/npm/prismjs/plugins/autoloader/prism-autoloader.min.js + + artitalk: https://cdn.jsdelivr.net/npm/artitalk \ No newline at end of file diff --git a/layout/flink.pug b/layout/flink.pug deleted file mode 100644 index fab186c..0000000 --- a/layout/flink.pug +++ /dev/null @@ -1,24 +0,0 @@ -#page - .flink#article-container - if site.data.link - each i in site.data.link - if i.class_name - h2!= i.class_name - if i.class_desc - .flink-desc!=i.class_desc - .flink-list - each item in i.link_list - .flink-list-item - a(href=url_for(item.link) title=item.name target="_blank") - if theme.lazyload.enable - img(data-lazy-src=url_for(item.avatar) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt=item.name ) - else - img(src=url_for(item.avatar) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt=item.name ) - span.flink-item-name= item.name - span.flink-item-desc(title=item.descr)= item.descr - != page.content - if page.comments !== false && theme.comments && theme.comments.use - - var commentsJsLoad = true - !=partial('includes/third-party/comments/index', {}, {cache:theme.fragment_cache}) - - diff --git a/layout/includes/additional-js.pug b/layout/includes/additional-js.pug index 42eb175..16ff624 100644 --- a/layout/includes/additional-js.pug +++ b/layout/includes/additional-js.pug @@ -35,6 +35,9 @@ div .js-pjax if theme.subtitle.enable && is_home() && theme.index_img !== false include ./third-party/subtitle.pug + + if page.type === 'artitalk' + include ./third-party/artitalk.pug include ./third-party/math/index.pug diff --git a/layout/includes/page/artitalk.pug b/layout/includes/page/artitalk.pug new file mode 100644 index 0000000..9103f92 --- /dev/null +++ b/layout/includes/page/artitalk.pug @@ -0,0 +1 @@ +#artitalk_main \ No newline at end of file diff --git a/layout/includes/page/categories.pug b/layout/includes/page/categories.pug new file mode 100644 index 0000000..dbdc980 --- /dev/null +++ b/layout/includes/page/categories.pug @@ -0,0 +1,5 @@ +.category-lists + .category-title.is-center= _p('page.category') + | - + span.category-amount= site.categories.length + div!= list_categories() \ No newline at end of file diff --git a/layout/includes/page/default-page.pug b/layout/includes/page/default-page.pug new file mode 100644 index 0000000..f995e44 --- /dev/null +++ b/layout/includes/page/default-page.pug @@ -0,0 +1,6 @@ +if theme.douban && theme.douban.meta && doubanExist + meta(name="referrer" content="no-referrer") +#article-container + if top_img === false + h1.page-title= page.title + != page.content \ No newline at end of file diff --git a/layout/includes/page/flink.pug b/layout/includes/page/flink.pug new file mode 100644 index 0000000..48bcf32 --- /dev/null +++ b/layout/includes/page/flink.pug @@ -0,0 +1,19 @@ +.flink#article-container + if site.data.link + each i in site.data.link + if i.class_name + h2!= i.class_name + if i.class_desc + .flink-desc!=i.class_desc + .flink-list + each item in i.link_list + .flink-list-item + a(href=url_for(item.link) title=item.name target="_blank") + if theme.lazyload.enable + img(data-lazy-src=url_for(item.avatar) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt=item.name ) + else + img(src=url_for(item.avatar) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt=item.name ) + span.flink-item-name= item.name + span.flink-item-desc(title=item.descr)= item.descr + != page.content + diff --git a/layout/includes/page/tags.pug b/layout/includes/page/tags.pug new file mode 100644 index 0000000..4d57e43 --- /dev/null +++ b/layout/includes/page/tags.pug @@ -0,0 +1,5 @@ +.tag-cloud-title.is-center= _p('page.tag') + | - + span.tag-cloud-amount= site.tags.length +.tag-cloud-list.is-center + !=cloudTags({source: site.tags, minfontsize: 1.2, maxfontsize: 2.1, limit: 0, unit: 'em'}) \ No newline at end of file diff --git a/layout/includes/third-party/artitalk.pug b/layout/includes/third-party/artitalk.pug new file mode 100644 index 0000000..40490fb --- /dev/null +++ b/layout/includes/third-party/artitalk.pug @@ -0,0 +1,24 @@ +- let option = theme.artitalk.option ? JSON.stringify(theme.artitalk.option) : false + +script. + (()=>{ + let setting = { + appId: '!{theme.artitalk.appId}', + appKey: '!{theme.artitalk.appKey}', + } + + if (!{Boolean(option)}) { + const otherSetting = !{option} + setting = Object.assign({}, setting, otherSetting) + } + + const init = () => { + new Artitalk(setting) + } + + if (typeof Artitalk === 'function') { + init() + } else { + $.getScript('!{theme.CDN.artitalk}',init) + } + })() \ No newline at end of file diff --git a/layout/page.pug b/layout/page.pug index 31324e1..474580d 100644 --- a/layout/page.pug +++ b/layout/page.pug @@ -1,36 +1,19 @@ extends includes/layout.pug block content - if page.type === 'tags' - .tag-cloud - .tag-cloud__title= _p('page.tag') - | - - span.tag-cloud__amount= site.tags.length - .tag-cloud-tags - !=cloudTags({source: site.tags, minfontsize: 1.2, maxfontsize: 2.1, limit: 0, unit: 'em'}) - if page.comments !== false && theme.comments && theme.comments.use - - var commentsJsLoad = true - !=partial('includes/third-party/comments/index', {}, {cache:theme.fragment_cache}) - else if page.type === 'link' - include flink.pug - else if page.type === 'categories' - .category-content - .category-lists - .category__title= _p('page.category') - | - - span.category__amount= site.categories.length - div!= list_categories() - if page.comments !== false && theme.comments && theme.comments.use - - var commentsJsLoad = true - !=partial('includes/third-party/comments/index', {}, {cache:theme.fragment_cache}) - else - #page - if theme.douban && theme.douban.meta && doubanExist - meta(name="referrer" content="no-referrer") - #article-container - if top_img === false - h1.page-title= page.title - != page.content - if page.comments !== false && theme.comments && theme.comments.use - - var commentsJsLoad = true - !=partial('includes/third-party/comments/index', {}, {cache:theme.fragment_cache}) \ No newline at end of file + #page + case page.type + when 'tags' + include includes/page/tags.pug + when 'link' + include includes/page/flink.pug + when 'categories' + include includes/page/categories.pug + when 'artitalk' + include includes/page/artitalk.pug + default + include includes/page/default-page.pug + + if page.comments !== false && theme.comments && theme.comments.use + - var commentsJsLoad = true + !=partial('includes/third-party/comments/index', {}, {cache:theme.fragment_cache}) \ No newline at end of file diff --git a/package.json b/package.json index 36c6e30..d96b0e0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hexo-theme-butterfly", - "version": "3.2.0-b4", + "version": "3.2.0-b5", "description": "A Simple and Card UI Design theme for Hexo", "main": "package.json", "scripts": { diff --git a/source/css/_mode/darkmode.styl b/source/css/_mode/darkmode.styl index b02b484..541e39c 100644 --- a/source/css/_mode/darkmode.styl +++ b/source/css/_mode/darkmode.styl @@ -162,3 +162,8 @@ if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark' blockquote color: alpha(#FFFFFF, .7) + + #artitalk_main #lazy + background: #121212 + #operare_artitalk .c2 + background: #121212 \ No newline at end of file diff --git a/source/css/_page/categories.styl b/source/css/_page/categories.styl index 3f668ca..4e2d9cb 100644 --- a/source/css/_page/categories.styl +++ b/source/css/_page/categories.styl @@ -1,12 +1,11 @@ -.category-content +#page .category-lists padding: 1rem 0 1.5rem +maxWidth768() padding: 0 - .category__title - text-align: center + .category-title font-size: 2.57em +maxWidth768() diff --git a/source/css/_page/common.styl b/source/css/_page/common.styl index f101ffe..fbb2e82 100644 --- a/source/css/_page/common.styl +++ b/source/css/_page/common.styl @@ -39,13 +39,8 @@ &:hover box-shadow: 0 4px 12px 12px rgba(7, 17, 27, .15) -+minWidth900() - if hexo-config('aside.position') == 'left' - #recent-posts, - #page, - .category-content, - #archive, - .tag-cloud, - #tag, - #category - order: 2 \ No newline at end of file +if hexo-config('aside.position') == 'left' + +minWidth900() + .layout_page + & > div:first-child + order: 2 \ No newline at end of file diff --git a/source/css/_layout/flink.styl b/source/css/_page/flink.styl similarity index 100% rename from source/css/_layout/flink.styl rename to source/css/_page/flink.styl diff --git a/source/css/_page/tags.styl b/source/css/_page/tags.styl index 4e3eba6..ff9ad43 100644 --- a/source/css/_page/tags.styl +++ b/source/css/_page/tags.styl @@ -1,19 +1,18 @@ .tag-cloud - text-align: center + &-list + a + display: inline-block + padding: 0 .4rem + transition: all .3s - a - display: inline-block - padding: 0 .4rem - transition: all .3s + &:hover + color: $text-hover !important + transform: scale(1.1) - &:hover - color: $text-hover !important - transform: scale(1.1) + +maxWidth768() + zoom: .85 - +maxWidth768() - zoom: .85 - - &__title + &-title font-size: 2.57em +maxWidth768()