diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index f8c2d62..1deada7 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -26,7 +26,7 @@ If you are a problem when visiting the website, please open your browser 'develo - [] Yes, I have read [Hexo Docs page](https://hexo.io/docs/), especially [Templates](https://hexo.io/docs/templates.html), [Variables](https://hexo.io/docs/variables.html), [Helpers](https://hexo.io/docs/helpers.html) and [Troubleshooting](https://hexo.io/docs/troubleshooting.html). -- [] Yes, I have read [Butterfly Documentation](https://demo.jerryc.me/posts/21cfbf15/). +- [] Yes, I have read [Butterfly Documentation](https://butterfly.js.org/posts/21cfbf15/). - [] And yes, I already searched for current [issues](https://github.com/jerryc127/hexo-theme-butterfly/issues?utf8=%E2%9C%93&q=is%3Aissue) and this did not help me. ## Butterfly Information diff --git a/README.md b/README.md index 8ee13da..4e851b4 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ npm i hexo-theme-butterfly - [x] Related articles - [x] Displays outdated notice for a post - [x] Share (AddThis/Sharejs/Addtoany) -- [X] Comment (Disqus/Disqusjs/Livere/Gitalk/Valine/Utterances/Facebook Comments) +- [X] Comment (Disqus/Disqusjs/Livere/Gitalk/Valine/Utterances/Facebook Comments/Twikoo) - [x] Multiple Comment System Support - [x] Online Chats (Chatra/Tidio/Daovoice/Gitter/Crisp) - [x] Web analytics (Baidu Analytics/Google Analytics/Tencent Analytics/CNZZ Analytics) diff --git a/README_CN.md b/README_CN.md index 3a6e6a8..713e6f4 100644 --- a/README_CN.md +++ b/README_CN.md @@ -71,7 +71,7 @@ theme: butterfly - [x] 顯示相關文章 - [x] 過期文章提醒 - [x] 多種分享系統(AddThis/Sharejs/Addtoany) -- [X] 多種評論系統(Disqus/Disqusjs/Livere/Gitalk/Valine/Utterances/Facebook Comments) +- [X] 多種評論系統(Disqus/Disqusjs/Livere/Gitalk/Valine/Utterances/Facebook Comments/Twikoo) - [x] 支持雙評論部署 - [x] 多種在線聊天(Chatra/Tidio/Daovoice/Gitter/Crisp) - [x] 多種分析系統(百度分析/谷歌分析/騰訊分析/CNZZ分析) diff --git a/_config.yml b/_config.yml index 46eba27..966bcd5 100644 --- a/_config.yml +++ b/_config.yml @@ -542,6 +542,7 @@ ClickShowText: # - LOVE # - YOU fontSize: 15px + random: false mobile: false # Default display mode (網站默認的顯示模式) @@ -814,6 +815,9 @@ Open_Graph_meta: true # Caches the contents in a fragment, speed up the generation (開啟hexo自帶的緩存,加快生成速度) fragment_cache: true +# Add the vendor prefixes to ensure compatibility +css_prefix: true + # Inject # Insert the code to head (before '' tag) and the bottom (before '' tag) # 插入代码到头部 之前 和 底部 之前 diff --git a/languages/default.yml b/languages/default.yml index d1699c3..bc5dcbc 100644 --- a/languages/default.yml +++ b/languages/default.yml @@ -41,7 +41,6 @@ local_search: label: Local search input_placeholder: Search for Posts hits_empty: "We didn't find any results for the search: ${query}" - powered_by: Powered by pagination: prev: Previous Post diff --git a/languages/en.yml b/languages/en.yml index d1699c3..bc5dcbc 100644 --- a/languages/en.yml +++ b/languages/en.yml @@ -41,7 +41,6 @@ local_search: label: Local search input_placeholder: Search for Posts hits_empty: "We didn't find any results for the search: ${query}" - powered_by: Powered by pagination: prev: Previous Post diff --git a/languages/zh-CN.yml b/languages/zh-CN.yml index 2a1a762..16c45d3 100644 --- a/languages/zh-CN.yml +++ b/languages/zh-CN.yml @@ -42,8 +42,6 @@ local_search: label: 本地搜索 input_placeholder: 搜索文章 hits_empty: '找不到您查询的内容:${query}' - powered: '提供支持' - by: 由 pagination: prev: 上一篇 diff --git a/languages/zh-TW.yml b/languages/zh-TW.yml index 2b30d2a..aa250aa 100644 --- a/languages/zh-TW.yml +++ b/languages/zh-TW.yml @@ -42,8 +42,6 @@ local_search: label: 本地搜尋 input_placeholder: 搜尋文章 hits_empty: '找不到您查詢的內容:${query}' - powered: '提供支援' - by: 由 pagination: prev: 上一篇 diff --git a/layout/includes/additional-js.pug b/layout/includes/additional-js.pug index 8d912b7..523655b 100644 --- a/layout/includes/additional-js.pug +++ b/layout/includes/additional-js.pug @@ -1,5 +1,4 @@ div - script(src=url_for(theme.CDN.jquery)) script(src=url_for(theme.CDN.utils)) script(src=url_for(theme.CDN.main)) @@ -8,11 +7,9 @@ div if theme.medium_zoom script(src=url_for(theme.CDN.medium_zoom)) - else if theme.fancybox - script(src=url_for(theme.CDN.fancybox)) if theme.instantpage - script(src=url_for(theme.CDN.instantpage) type="module" defer) + script(src=url_for(theme.CDN.instantpage) type="module") if theme.lazyload.enable script(src=url_for(theme.CDN.lazyload)) @@ -35,9 +32,6 @@ 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/head.pug b/layout/includes/head.pug index ec8a57a..c3497ec 100644 --- a/layout/includes/head.pug +++ b/layout/includes/head.pug @@ -53,9 +53,6 @@ if (theme.pwa && theme.pwa.enable) link(rel='stylesheet', href=url_for(theme.CDN.main_css)) link(rel='stylesheet', href=url_for(theme.CDN.fontawesome)) -if theme.fancybox - link(rel='stylesheet', href=url_for(theme.CDN.fancybox_css)) - if (theme.snackbar && theme.snackbar.enable) link(rel='stylesheet', href=url_for(theme.CDN.snackbar_css)) diff --git a/layout/includes/head/config.pug b/layout/includes/head/config.pug index 99e3001..9a4b869 100644 --- a/layout/includes/head/config.pug +++ b/layout/includes/head/config.pug @@ -54,7 +54,8 @@ if (theme.ClickShowText && theme.ClickShowText.enable) { ClickShowText = JSON.stringify({ text: theme.ClickShowText.text.join(","), - fontSize: theme.ClickShowText.fontSize + fontSize: theme.ClickShowText.fontSize, + random: theme.ClickShowText.random }) } @@ -119,9 +120,16 @@ script. ClickShowText: !{ClickShowText}, lightbox: '!{ theme.medium_zoom ? "mediumZoom" : (theme.fancybox ? "fancybox" : "null" )}', Snackbar: !{Snackbar}, - justifiedGallery: { - js: '!{theme.CDN.justifiedGallery_js}', - css: '!{theme.CDN.justifiedGallery_css}' + source: { + jQuery: '!{url_for(theme.CDN.jquery)}', + justifiedGallery: { + js: '!{url_for(theme.CDN.justifiedGallery_js)}', + css: '!{url_for(theme.CDN.justifiedGallery_css)}' + }, + fancybox: { + js: '!{url_for(theme.CDN.fancybox)}', + css: '!{url_for(theme.CDN.fancybox_css)}' + } }, isPhotoFigcaption: !{theme.photofigcaption}, islazyload: !{theme.lazyload.enable}, @@ -156,5 +164,17 @@ script. } } - - + // https://stackoverflow.com/questions/16839698/jquery-getscript-alternative-in-native-javascript + const getScript = url => new Promise((resolve, reject) => { + const script = document.createElement('script') + script.src = url + script.async = true + script.onerror = reject + script.onload = script.onreadystatechange = function() { + const loadState = this.readyState + if (loadState && loadState !== 'loaded' && loadState !== 'complete') return + script.onload = script.onreadystatechange = null + resolve() + } + document.head.appendChild(script) + }) \ No newline at end of file diff --git a/layout/includes/head/preconnect.pug b/layout/includes/head/preconnect.pug index 3d7b9e9..1200a20 100644 --- a/layout/includes/head/preconnect.pug +++ b/layout/includes/head/preconnect.pug @@ -1,7 +1,7 @@ link(rel="preconnect" href="//cdn.jsdelivr.net") if theme.google_analytics - link(rel="preconnect" href="//www.google-analytics.com" crossorigin) + link(rel="preconnect" href="//www.google-analytics.com" crossorigin='') if theme.baidu_analytics link(rel="preconnect" href="//hm.baidu.com") @@ -13,7 +13,7 @@ if theme.cnzz_analytics link(rel="preconnect" href="//s4.cnzz.com") if theme.blog_title_font && theme.blog_title_font.font_link && theme.blog_title_font.font_link.indexOf('//fonts.googleapis.com') != -1 - link(rel="preconnect" href="//fonts.googleapis.com" crossorigin) + link(rel="preconnect" href="//fonts.googleapis.com" crossorigin='') if theme.busuanzi.site_uv || theme.busuanzi.site_pv || theme.busuanzi.page_pv link(rel="preconnect" href="//busuanzi.ibruce.info") diff --git a/layout/includes/header/nav.pug b/layout/includes/header/nav.pug index 332adf6..e5660e1 100644 --- a/layout/includes/header/nav.pug +++ b/layout/includes/header/nav.pug @@ -2,15 +2,15 @@ nav#nav span#blog_name a#site-name(href=url_for('/')) #[=config.title] - span#menus + #menus if (theme.algolia_search.enable || theme.local_search.enable) - #search_button + #search-button a.site-page.social-icon.search i.fas.fa-search.fa-fw span=' '+_p('search') !=fragment_cache('menus', function(){return partial('includes/header/menu_item')}) - span#toggle-menu.close + #toggle-menu a.site-page i.fas.fa-bars.fa-fw diff --git a/layout/includes/mixins/post-ui.pug b/layout/includes/mixins/post-ui.pug index 7748b8e..b436dff 100644 --- a/layout/includes/mixins/post-ui.pug +++ b/layout/includes/mixins/post-ui.pug @@ -78,4 +78,4 @@ mixin postUI(posts) if theme.ad && theme.ad.index if (index + 1) % 3 == 0 - .recent-post-item.ad-height!=theme.ad.index + .recent-post-item.ads-wrap!=theme.ad.index diff --git a/layout/includes/page/artitalk.pug b/layout/includes/page/artitalk.pug index c5128bb..940b046 100644 --- a/layout/includes/page/artitalk.pug +++ b/layout/includes/page/artitalk.pug @@ -1,4 +1,28 @@ +- let option = theme.artitalk.option ? JSON.stringify(theme.artitalk.option) : false + if top_img === false h1.page-title= page.title -#artitalk_main \ No newline at end of file +#artitalk_main +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}').then(init) + } + })() \ No newline at end of file diff --git a/layout/includes/pagination.pug b/layout/includes/pagination.pug index ab09c1a..488055c 100644 --- a/layout/includes/pagination.pug +++ b/layout/includes/pagination.pug @@ -18,9 +18,9 @@ else - var pagination_cover = page.prev.cover === false ? page.prev.randomcover : page.prev.cover a(href=url_for(page.prev.path)) if theme.lazyload.enable - img.prev-cover(data-lazy-src=url_for(pagination_cover) onerror=`onerror=null;src='${url_for(theme.error_img.post_page)}'` ) + img.prev-cover(data-lazy-src=url_for(pagination_cover) onerror=`onerror=null;src='${url_for(theme.error_img.post_page)}'` alt='cover of previous post') else - img.prev-cover(src=url_for(pagination_cover) onerror=`onerror=null;src='${url_for(theme.error_img.post_page)}'` ) + img.prev-cover(src=url_for(pagination_cover) onerror=`onerror=null;src='${url_for(theme.error_img.post_page)}'` alt='cover of previous post') .pagination-info .label=_p('pagination.prev') .prev_info=page.prev.title @@ -31,9 +31,9 @@ else .next-post(class=hasPagePrev) a(href=url_for(page.next.path)) if theme.lazyload.enable - img.next-cover(data-lazy-src=url_for(pagination_cover) onerror=`onerror=null;src='${url_for(theme.error_img.post_page)}'`) + img.next-cover(data-lazy-src=url_for(pagination_cover) onerror=`onerror=null;src='${url_for(theme.error_img.post_page)}'` alt='cover of next post') else - img.next-cover(src=url_for(pagination_cover) onerror=`onerror=null;src='${url_for(theme.error_img.post_page)}'`) + img.next-cover(src=url_for(pagination_cover) onerror=`onerror=null;src='${url_for(theme.error_img.post_page)}'` alt='cover of next post') .pagination-info .label=_p('pagination.next') .next_info=page.next.title \ No newline at end of file diff --git a/layout/includes/third-party/artitalk.pug b/layout/includes/third-party/artitalk.pug deleted file mode 100644 index 40490fb..0000000 --- a/layout/includes/third-party/artitalk.pug +++ /dev/null @@ -1,24 +0,0 @@ -- 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/includes/third-party/baidu_push.pug b/layout/includes/third-party/baidu_push.pug index 13faf11..ac87a7b 100644 --- a/layout/includes/third-party/baidu_push.pug +++ b/layout/includes/third-party/baidu_push.pug @@ -3,11 +3,11 @@ if theme.baidu_push (function(){ const bp = document.createElement('script'); const curProtocol = window.location.protocol.split(':')[0]; - if (curProtocol === 'https'){ - bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; + if (curProtocol === 'https') { + bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else{ - bp.src = 'http://push.zhanzhang.baidu.com/push.js'; + bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } bp.dataset.pjax = '' const s = document.getElementsByTagName("script")[0]; diff --git a/layout/includes/third-party/comments/disqusjs.pug b/layout/includes/third-party/comments/disqusjs.pug index e2f3136..0e8d2f9 100644 --- a/layout/includes/third-party/comments/disqusjs.pug +++ b/layout/includes/third-party/comments/disqusjs.pug @@ -29,7 +29,7 @@ script. if (window.disqusJsLoad) initDisqusjs() else { addDisqusjsCSS() - $.getScript('!{url_for(theme.CDN.disqusjs)}', initDisqusjs) + getScript('!{url_for(theme.CDN.disqusjs)}').then(initDisqusjs) window.disqusJsLoad = true } } diff --git a/layout/includes/third-party/comments/gitalk.pug b/layout/includes/third-party/comments/gitalk.pug index 08bc422..dcd6eb6 100644 --- a/layout/includes/third-party/comments/gitalk.pug +++ b/layout/includes/third-party/comments/gitalk.pug @@ -28,7 +28,7 @@ script. if (typeof Gitalk === 'function') initGitalk() else { addGitalkSource() - $.getScript('!{url_for(theme.CDN.gitalk)}', initGitalk) + getScript('!{url_for(theme.CDN.gitalk)}').then(initGitalk) } } diff --git a/layout/includes/third-party/comments/twikoo.pug b/layout/includes/third-party/comments/twikoo.pug index 1e49ecd..b8cf4cf 100644 --- a/layout/includes/third-party/comments/twikoo.pug +++ b/layout/includes/third-party/comments/twikoo.pug @@ -9,7 +9,7 @@ script. if (typeof twikoo.init === 'function') { init() } else { - $.getScript('!{theme.CDN.twikoo}', init) + getScript('!{theme.CDN.twikoo}').then(init) } } diff --git a/layout/includes/third-party/comments/valine.pug b/layout/includes/third-party/comments/valine.pug index 6e09a81..8bb75ae 100644 --- a/layout/includes/third-party/comments/valine.pug +++ b/layout/includes/third-party/comments/valine.pug @@ -36,7 +36,7 @@ script. } if (typeof Valine === 'function') initValine() - else $.getScript('!{url_for(theme.CDN.valine)}', initValine) + else getScript('!{url_for(theme.CDN.valine)}').then(initValine) } if ('!{theme.comments.use[0]}' === 'Valine' || !!{theme.comments.lazyload}) { diff --git a/layout/includes/third-party/math/katex.pug b/layout/includes/third-party/math/katex.pug index 6690428..773bb99 100644 --- a/layout/includes/third-party/math/katex.pug +++ b/layout/includes/third-party/math/katex.pug @@ -2,6 +2,9 @@ link(rel="stylesheet" type="text/css" href=theme.CDN.katex) script(src=url_for(theme.CDN.katex_copytex)) link(rel="stylesheet" type="text/css" href=theme.CDN.katex_copytex_css) script. - $(function () { - $('span.katex-display').wrap('
') - }) \ No newline at end of file + (() => { + document.querySelectorAll('#article-container span.katex-display').forEach(item => { + btf.wrap(item, 'div', '', 'katex-wrap') + }) + })() + \ No newline at end of file diff --git a/layout/includes/third-party/math/mermaid.pug b/layout/includes/third-party/math/mermaid.pug index b872a79..801ce21 100644 --- a/layout/includes/third-party/math/mermaid.pug +++ b/layout/includes/third-party/math/mermaid.pug @@ -2,7 +2,7 @@ script. if (document.getElementsByClassName('mermaid').length) { if (window.mermaidJsLoad) mermaid.init() else { - $.getScript('!{theme.CDN.mermaid}', function () { + getScript('!{theme.CDN.mermaid}').then(() => { window.mermaidJsLoad = true mermaid.initialize({ theme: '!{theme.mermaid.theme}', diff --git a/layout/includes/third-party/newest-comments/disqus-comment.pug b/layout/includes/third-party/newest-comments/disqus-comment.pug index 5ed18db..fbbe281 100644 --- a/layout/includes/third-party/newest-comments/disqus-comment.pug +++ b/layout/includes/third-party/newest-comments/disqus-comment.pug @@ -14,24 +14,25 @@ script. } const getDisqusComment = () => { - let disqusArray = [] - $.getJSON('https://disqus.com/api/3.0/forums/listPosts.json?forum=!{theme.newest_comments.disqus.forum}&related=thread&limit=!{theme.newest_comments.limit}&api_key=!{theme.newest_comments.disqus.api_key}', function(data){ - $.each(data.response, (i, item) => { - disqusArray.push({ - 'avatar': item.author.avatar.cache, - 'content': changeContent(item.message), - 'nick': item.author.name, - 'url': item.url, - 'date': item.createdAt + fetch('https://disqus.com/api/3.0/forums/listPosts.json?forum=!{theme.newest_comments.disqus.forum}&related=thread&limit=!{theme.newest_comments.limit}&api_key=!{theme.newest_comments.disqus.api_key}') + .then(response => response.json()) + .then(data => { + const disqusArray = data.response.map(item => { + return { + 'avatar': item.author.avatar.cache, + 'content': changeContent(item.message), + 'nick': item.author.name, + 'url': item.url, + 'date': item.createdAt + } }) + // set expiry to 10 min + saveToLocal.set('disqus-newest-comments', JSON.stringify(disqusArray), 10/(60*24)) + generateHtml(disqusArray) + }).catch(e => { + const $dom = document.querySelector('#card-newest-comments .aside-list') + $dom.innerHTML= "!{_p('aside.card_newest_comments.error')}" }) - // set expiry to 10 min - saveToLocal.set('disqus-newest-comments', JSON.stringify(disqusArray), 10/(60*24)) - generateHtml(disqusArray) - }).fail(()=>{ - const $dom = document.querySelector('#card-newest-comments .aside-list') - $dom.innerHTML= "!{_p('aside.card_newest_comments.error')}" - }) } const generateHtml = array => { diff --git a/layout/includes/third-party/newest-comments/github-issues.pug b/layout/includes/third-party/newest-comments/github-issues.pug index e7e7bbc..a559ec0 100644 --- a/layout/includes/third-party/newest-comments/github-issues.pug +++ b/layout/includes/third-party/newest-comments/github-issues.pug @@ -14,23 +14,24 @@ script. } const getGithubIssues = () => { - let githubArray = [] - $.getJSON('https://api.github.com/repos/!{theme.newest_comments.github_issues.repo}/issues/comments?sort=updated&direction=desc&per_page=!{theme.newest_comments.limit}&page=1', (data) => { - $.each(data, (index, item) => { - githubArray.push({ - 'avatar': item.user.avatar_url, - 'content': changeContent(item.body), - 'nick': item.user.login, - 'url': item.html_url, - 'date': item.updated_at + fetch('https://api.github.com/repos/!{theme.newest_comments.github_issues.repo}/issues/comments?sort=updated&direction=desc&per_page=!{theme.newest_comments.limit}&page=1') + .then(response => response.json()) + .then(data => { + const githubArray = data.map(item => { + return { + 'avatar': item.user.avatar_url, + 'content': changeContent(item.body), + 'nick': item.user.login, + 'url': item.html_url, + 'date': item.updated_at + } }) + saveToLocal.set('github-newest-comments', JSON.stringify(githubArray), 10/(60*24)) + generateHtml(githubArray) + }).catch(e => { + const $dom = document.querySelector('#card-newest-comments .aside-list') + $dom.innerHTML= "!{_p('aside.card_newest_comments.error')}" }) - saveToLocal.set('github-newest-comments', JSON.stringify(githubArray), 10/(60*24)) - generateHtml(githubArray) - }).fail(()=>{ - const $dom = document.querySelector('#card-newest-comments .aside-list') - $dom.innerHTML= "!{_p('aside.card_newest_comments.error')}" - }) } const generateHtml = array => { diff --git a/layout/includes/third-party/newest-comments/leancloud.pug b/layout/includes/third-party/newest-comments/leancloud.pug index 2e6910a..edd80f9 100644 --- a/layout/includes/third-party/newest-comments/leancloud.pug +++ b/layout/includes/third-party/newest-comments/leancloud.pug @@ -51,9 +51,7 @@ script. } var settings = { - "url": `${serverURL}/1.1/classes/Comment?limit=!{theme.newest_comments.limit}&order=-createdAt`, "method": "GET", - "timeout": 0, "headers": { "X-LC-Id": '!{theme.newest_comments.leancloud.appId}', "X-LC-Key": '!{theme.newest_comments.leancloud.appKey}', @@ -61,26 +59,25 @@ script. }, } - $.ajax(settings).done((response) => { - var valineArray = [] - response.results.forEach((e)=>{ - valineArray.push({ - 'avatar': e.QQAvatar, - 'content': changeContent(e.comment), - 'mail': e.mail, - 'nick': e.nick, - 'url': e.url, - 'date': e.createdAt, + fetch(`${serverURL}/1.1/classes/Comment?limit=!{theme.newest_comments.limit}&order=-createdAt`,settings) + .then(response => response.json()) + .then(data => { + const valineArray = data.results.map(function (e) { + return { + 'avatar': e.QQAvatar, + 'content': changeContent(e.comment), + 'mail': e.mail, + 'nick': e.nick, + 'url': e.url, + 'date': e.createdAt, + } }) - }) - - saveToLocal.set('leancloud-newest-comments', JSON.stringify(valineArray), 10/(60*24)) - generateHtml(valineArray) - - }).fail(()=>{ - const $dom = document.querySelector('#card-newest-comments .aside-list') - $dom.innerHTML= "!{_p('aside.card_newest_comments.error')}" - }) + saveToLocal.set('leancloud-newest-comments', JSON.stringify(valineArray), 10/(60*24)) + generateHtml(valineArray) + }).catch(e => { + const $dom = document.querySelector('#card-newest-comments .aside-list') + $dom.innerHTML= "!{_p('aside.card_newest_comments.error')}" + }) } const newestCommentInit = () => { diff --git a/layout/includes/third-party/pangu.pug b/layout/includes/third-party/pangu.pug index 229c69b..e61305f 100644 --- a/layout/includes/third-party/pangu.pug +++ b/layout/includes/third-party/pangu.pug @@ -2,9 +2,10 @@ script. function panguFn () { if (typeof pangu === 'object') pangu.spacingElementById('content-inner') else { - $.getScript('!{url_for(theme.CDN.pangu)}', () => { - pangu.spacingElementById('content-inner') - }) + getScript('!{url_for(theme.CDN.pangu)}') + .then(() => { + pangu.spacingElementById('content-inner') + }) } } @@ -16,4 +17,4 @@ script. } } - document.addEventListener('DOMContentLoaded', panguFn) + document.addEventListener('DOMContentLoaded', panguInit) diff --git a/layout/includes/third-party/pjax.pug b/layout/includes/third-party/pjax.pug index e3c63be..0d41660 100644 --- a/layout/includes/third-party/pjax.pug +++ b/layout/includes/third-party/pjax.pug @@ -29,8 +29,12 @@ script. document.addEventListener('pjax:complete', function () { window.refreshFn() - $('script[data-pjax]').each(function () { - $(this).parent().append($(this).remove()) + document.querySelectorAll('script[data-pjax]').forEach(item => { + const newScript = document.createElement('script') + const content = item.text || item.textContent || item.innerHTML || "" + Array.from(item.attributes).forEach(attr => newScript.setAttribute(attr.name, attr.value)) + newScript.appendChild(document.createTextNode(content)) + item.parentNode.replaceChild(newScript, item) }) GLOBAL_CONFIG.islazyload && window.lazyLoadInstance.update() @@ -69,10 +73,8 @@ script. typeof typed === 'object' && typed.destroy() - $(window).off('scroll') - //reset readmode - $('body').hasClass('read-mode') && $('body').removeClass('read-mode') + const $bodyClassList = document.body.classList + $bodyClassList.contains('read-mode') && $bodyClassList.remove('read-mode') }) - diff --git a/layout/includes/third-party/search/local-search.pug b/layout/includes/third-party/search/local-search.pug index 69570a2..dec1569 100644 --- a/layout/includes/third-party/search/local-search.pug +++ b/layout/includes/third-party/search/local-search.pug @@ -7,18 +7,6 @@ input(placeholder=_p("local_search.input_placeholder") type="text").local-search-box--input hr #local-search-results - #local-hits - #local-stats - #hr.local-search-stats__hr - case config.language - when "zh-CN" - span=_p("local_search.by") - | #[a(href="https://github.com/wzpan/hexo-generator-search" style={'color': '#49B1F5'}) hexo-generator-search] - | #[span=_p("local_search.powered")] - when "en" - default - span=_p("local_search.powered_by") - | #[a(href="https://github.com/wzpan/hexo-generator-search" style={'color': '#49B1F5'}) hexo-generator-search] span.search-close-button i.fas.fa-times #search-mask \ No newline at end of file diff --git a/layout/includes/third-party/subtitle.pug b/layout/includes/third-party/subtitle.pug index ad995cc..84830d1 100644 --- a/layout/includes/third-party/subtitle.pug +++ b/layout/includes/third-party/subtitle.pug @@ -1,28 +1,34 @@ -- var source = theme.subtitle.source +- let source = theme.subtitle.source + case source when 1 script. function subtitleType () { - $.getJSON('https://api.btstu.cn/yan/api.php?charset=utf-8&encode=json',function (data) { - if (!{theme.subtitle.effect}) { - var sub = "!{theme.subtitle.sub}".length == 0 ? new Array() : "!{theme.subtitle.sub}".split(',') - var both = sub.unshift(data.text) - typed = new Typed('#subtitle', { - strings: sub, - startDelay: 300, - typeSpeed: 150, - loop: !{theme.subtitle.loop}, - backSpeed: 50, - }) - } else { - document.getElementById('subtitle').innerHTML = data.text - } - }) + fetch('https://api.btstu.cn/yan/api.php?charset=utf-8&encode=json') + .then(response => response.json()) + .then(data => { + if (!{theme.subtitle.effect}) { + var sub = "!{theme.subtitle.sub}".length == 0 ? new Array() : "!{theme.subtitle.sub}".split(',') + var both = sub.unshift(data.text) + typed = new Typed('#subtitle', { + strings: sub, + startDelay: 300, + typeSpeed: 150, + loop: !{theme.subtitle.loop}, + backSpeed: 50, + }) + } else { + document.getElementById('subtitle').innerHTML = data.text + } + }) } if (!{theme.subtitle.effect}) { - if (typeof Typed === 'function') subtitleType() - else $.getScript('!{url_for(theme.CDN.typed)}', subtitleType) + if (typeof Typed === 'function') { + subtitleType() + } else { + getScript('!{url_for(theme.CDN.typed)}').then(subtitleType) + } } else { subtitleType() } @@ -30,27 +36,32 @@ case source when 2 script. function subtitleType () { - $.getJSON('https://v1.hitokoto.cn', function (data) { - if (!{theme.subtitle.effect}) { - var from = '出自 ' + data.from - var sub = "!{theme.subtitle.sub}".length == 0 ? new Array() : "!{theme.subtitle.sub}".split(',') - var both = sub.unshift(data.hitokoto, from) - var typed = new Typed('#subtitle', { - strings: sub, - startDelay: 300, - typeSpeed: 150, - loop: !{theme.subtitle.loop}, - backSpeed: 50, - }) - } else { - document.getElementById('subtitle').innerHTML = data.hitokoto - } - }) + fetch('https://v1.hitokoto.cn') + .then(response => response.json()) + .then(data => { + if (!{theme.subtitle.effect}) { + var from = '出自 ' + data.from + var sub = "!{theme.subtitle.sub}".length == 0 ? new Array() : "!{theme.subtitle.sub}".split(',') + var both = sub.unshift(data.hitokoto, from) + var typed = new Typed('#subtitle', { + strings: sub, + startDelay: 300, + typeSpeed: 150, + loop: !{theme.subtitle.loop}, + backSpeed: 50, + }) + } else { + document.getElementById('subtitle').innerHTML = data.hitokoto + } + }) } if (!{theme.subtitle.effect}) { - if (typeof Typed === 'function') subtitleType() - else $.getScript('!{url_for(theme.CDN.typed)}', subtitleType) + if (typeof Typed === 'function') { + subtitleType() + } else { + getScript('!{url_for(theme.CDN.typed)}').then(subtitleType) + } } else { subtitleType() } @@ -58,7 +69,7 @@ case source when 3 script. function subtitleType () { - $.getScript('http://yijuzhan.com/api/word.php?m=js', function () { + getScript('http://yijuzhan.com/api/word.php?m=js').then(() => { var con = str[0] if (!{theme.subtitle.effect}) { var from = '出自 ' + str[1] @@ -78,8 +89,11 @@ case source } if (!{theme.subtitle.effect}) { - if (typeof Typed === 'function') subtitleType() - else $.getScript('!{url_for(theme.CDN.typed)}', subtitleType) + if (typeof Typed === 'function') { + subtitleType() + } else { + getScript('!{url_for(theme.CDN.typed)}').then(subtitleType) + } } else { subtitleType() } @@ -87,7 +101,7 @@ case source when 4 script. function subtitleType () { - $.getScript('https://sdk.jinrishici.com/v2/browser/jinrishici.js',function () { + getScript('https://sdk.jinrishici.com/v2/browser/jinrishici.js').then(() => { jinrishici.load(function (result) { if (!{theme.subtitle.effect}) { var sub = "!{theme.subtitle.sub}".length == 0 ? new Array() : "!{theme.subtitle.sub}".split(',') @@ -108,8 +122,11 @@ case source } if (!{theme.subtitle.effect}) { - if (typeof Typed === 'function') subtitleType() - else $.getScript('!{url_for(theme.CDN.typed)}', subtitleType) + if (typeof Typed === 'function') { + subtitleType() + } else { + getScript('!{url_for(theme.CDN.typed)}').then(subtitleType) + } } else { subtitleType() } @@ -131,8 +148,11 @@ case source } if (!{theme.subtitle.effect}) { - if (typeof Typed === 'function') subtitleType() - else $.getScript('!{url_for(theme.CDN.typed)}', subtitleType) + if (typeof Typed === 'function') { + subtitleType() + } else { + getScript('!{url_for(theme.CDN.typed)}').then(subtitleType) + } } else { subtitleType() - } \ No newline at end of file + } diff --git a/layout/includes/widget/card_ad.pug b/layout/includes/widget/card_ad.pug index c05f774..b8e00fd 100644 --- a/layout/includes/widget/card_ad.pug +++ b/layout/includes/widget/card_ad.pug @@ -1,2 +1,3 @@ -.card-widget.card-ad - != theme.ad.aside +if theme.ad && theme.ad.aside + .card-widget.ads-wrap + != theme.ad.aside diff --git a/layout/includes/widget/card_announcement.pug b/layout/includes/widget/card_announcement.pug index 5f6fbd1..0dcda40 100644 --- a/layout/includes/widget/card_announcement.pug +++ b/layout/includes/widget/card_announcement.pug @@ -1,6 +1,7 @@ -.card-widget.card-announcement - .card-content - .item-headline - i.fas.fa-bullhorn.card-announcement-animation - span= _p('aside.card_announcement') - .announcement_content!= theme.aside.card_announcement.content \ No newline at end of file +if theme.aside.card_announcement.enable + .card-widget.card-announcement + .card-content + .item-headline + i.fas.fa-bullhorn.card-announcement-animation + span= _p('aside.card_announcement') + .announcement_content!= theme.aside.card_announcement.content \ No newline at end of file diff --git a/layout/includes/widget/card_archives.pug b/layout/includes/widget/card_archives.pug index dfb5775..b1ce93d 100644 --- a/layout/includes/widget/card_archives.pug +++ b/layout/includes/widget/card_archives.pug @@ -1,11 +1,12 @@ -.card-widget.card-archives - .card-content - .item-headline - i.fas.fa-archive - span= _p('aside.card_archives') - - - let type = theme.aside.card_archives.type || 'monthly' - - let format = theme.aside.card_archives.format || 'MMMM YYYY' - - let order = theme.aside.card_archives.order || -1 - - let limit = theme.aside.card_archives.limit === 0 ? 0 : theme.aside.card_archives.limit || 8 - != aside_archives({ type:type, format: format, order: order, limit: limit }) +if theme.aside.card_archives.enable + .card-widget.card-archives + .card-content + .item-headline + i.fas.fa-archive + span= _p('aside.card_archives') + + - let type = theme.aside.card_archives.type || 'monthly' + - let format = theme.aside.card_archives.format || 'MMMM YYYY' + - let order = theme.aside.card_archives.order || -1 + - let limit = theme.aside.card_archives.limit === 0 ? 0 : theme.aside.card_archives.limit || 8 + != aside_archives({ type:type, format: format, order: order, limit: limit }) diff --git a/layout/includes/widget/card_author.pug b/layout/includes/widget/card_author.pug index b1faefb..00ed643 100644 --- a/layout/includes/widget/card_author.pug +++ b/layout/includes/widget/card_author.pug @@ -1,36 +1,37 @@ -.card-widget.card-info - .card-content - .card-info-avatar.is-center - if theme.lazyload.enable - img.avatar-img(data-lazy-src=url_for(theme.avatar.img) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt="avatar") - else - img.avatar-img(src=url_for(theme.avatar.img) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt="avatar") - .author-info__name= config.author - .author-info__description!= theme.aside.card_author.description || config.description +if theme.aside.card_author.enable + .card-widget.card-info + .card-content + .card-info-avatar.is-center + if theme.lazyload.enable + img.avatar-img(data-lazy-src=url_for(theme.avatar.img) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt="avatar") + else + img.avatar-img(src=url_for(theme.avatar.img) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt="avatar") + .author-info__name= config.author + .author-info__description!= theme.aside.card_author.description || config.description - .card-info-data - if site.posts.length - .card-info-data-item.is-center - a(href=url_for(config.archive_dir) + '/') - .headline= _p('aside.articles') - .length-num= site.posts.length + .card-info-data + if site.posts.length + .card-info-data-item.is-center + a(href=url_for(config.archive_dir) + '/') + .headline= _p('aside.articles') + .length-num= site.posts.length - if site.tags.length - .card-info-data-item.is-center - a(href=url_for(config.tag_dir) + '/') - .headline= _p('aside.tags') - .length-num= site.tags.length + if site.tags.length + .card-info-data-item.is-center + a(href=url_for(config.tag_dir) + '/') + .headline= _p('aside.tags') + .length-num= site.tags.length - if site.categories.length - .card-info-data-item.is-center - a(href=url_for(config.category_dir) + '/') - .headline= _p('aside.categories') - .length-num= site.categories.length + if site.categories.length + .card-info-data-item.is-center + a(href=url_for(config.category_dir) + '/') + .headline= _p('aside.categories') + .length-num= site.categories.length - a#card-info-btn.button--animated(href=theme.aside.card_author.button.link) - i(class=theme.aside.card_author.button.icon) - span=theme.aside.card_author.button.text - - if(theme.social) - .card-info-social-icons.is-center - !=fragment_cache('social', function(){return partial('includes/header/social')}) + a#card-info-btn.button--animated(href=theme.aside.card_author.button.link) + i(class=theme.aside.card_author.button.icon) + span=theme.aside.card_author.button.text + + if(theme.social) + .card-info-social-icons.is-center + !=fragment_cache('social', function(){return partial('includes/header/social')}) diff --git a/layout/includes/widget/card_categories.pug b/layout/includes/widget/card_categories.pug index 55c1827..eab8ba8 100644 --- a/layout/includes/widget/card_categories.pug +++ b/layout/includes/widget/card_categories.pug @@ -1,9 +1,8 @@ -if site.categories.length - .card-widget.card-categories - .card-content - .item-headline - i.fas.fa-folder-open - span= _p('aside.card_categories') - !=aside_categories({ limit: theme.aside.card_categories.limit === 0 ? 0 : theme.aside.card_categories.limit || 8 , expand: theme.aside.card_categories.expand }) - - +if theme.aside.card_categories.enable + if site.categories.length + .card-widget.card-categories + .card-content + .item-headline + i.fas.fa-folder-open + span= _p('aside.card_categories') + !=aside_categories({ limit: theme.aside.card_categories.limit === 0 ? 0 : theme.aside.card_categories.limit || 8 , expand: theme.aside.card_categories.expand }) diff --git a/layout/includes/widget/card_newest_comment.pug b/layout/includes/widget/card_newest_comment.pug index 76a19aa..bf88d05 100644 --- a/layout/includes/widget/card_newest_comment.pug +++ b/layout/includes/widget/card_newest_comment.pug @@ -1,7 +1,8 @@ -.card-widget#card-newest-comments - .card-content - .item-headline - i.fas.fa-bolt - span= _p('aside.card_newest_comments.headline') - .aside-list - span= _p('aside.card_newest_comments.loading_text') +if theme.newest_comments.enable + .card-widget#card-newest-comments + .card-content + .item-headline + i.fas.fa-bolt + span= _p('aside.card_newest_comments.headline') + .aside-list + span= _p('aside.card_newest_comments.loading_text') diff --git a/layout/includes/widget/card_recent_post.pug b/layout/includes/widget/card_recent_post.pug index 03cba6e..fe90d70 100644 --- a/layout/includes/widget/card_recent_post.pug +++ b/layout/includes/widget/card_recent_post.pug @@ -1,27 +1,28 @@ -.card-widget.card-recent-post - .card-content - .item-headline - i.fas.fa-history - span= _p('aside.card_recent_post') - .aside-list - - let postLimit = theme.aside.card_recent_post.limit === 0 ? site.posts.length : theme.aside.card_recent_post.limit || 5 - - let sort = theme.aside.card_recent_post.sort === 'updated' ? 'updated' : 'date' - - site.posts.sort(sort, -1).limit(postLimit).each(function(article){ - - let link = article.link || article.path - - let title = article.title || _p('no_title') - - let no_cover = article.cover === false || !theme.cover.aside_enable ? 'no-cover' : '' - - let post_cover = article.cover - .aside-list-item(class=no_cover) - if post_cover && theme.cover.aside_enable - a.thumbnail(href=url_for(link) title=title) - if theme.lazyload.enable - img(data-lazy-src=url_for(post_cover) onerror=`this.onerror=null;this.src='${url_for(theme.error_img.post_page)}'` alt=title) +if theme.aside.card_recent_post.enable + .card-widget.card-recent-post + .card-content + .item-headline + i.fas.fa-history + span= _p('aside.card_recent_post') + .aside-list + - let postLimit = theme.aside.card_recent_post.limit === 0 ? site.posts.length : theme.aside.card_recent_post.limit || 5 + - let sort = theme.aside.card_recent_post.sort === 'updated' ? 'updated' : 'date' + - site.posts.sort(sort, -1).limit(postLimit).each(function(article){ + - let link = article.link || article.path + - let title = article.title || _p('no_title') + - let no_cover = article.cover === false || !theme.cover.aside_enable ? 'no-cover' : '' + - let post_cover = article.cover + .aside-list-item(class=no_cover) + if post_cover && theme.cover.aside_enable + a.thumbnail(href=url_for(link) title=title) + if theme.lazyload.enable + img(data-lazy-src=url_for(post_cover) onerror=`this.onerror=null;this.src='${url_for(theme.error_img.post_page)}'` alt=title) + else + img(src=url_for(post_cover) onerror=`this.onerror=null;this.src='${url_for(theme.error_img.post_page)}'` alt=title) + .content + a.title(href=url_for(link) title=title)= title + if theme.aside.card_recent_post.sort === 'updated' + time(datetime=date_xml(article.updated) title=_p('post.updated') + ' ' + full_date(article.updated)) #[=date(article.updated, config.date_format)] else - img(src=url_for(post_cover) onerror=`this.onerror=null;this.src='${url_for(theme.error_img.post_page)}'` alt=title) - .content - a.title(href=url_for(link) title=title)= title - if theme.aside.card_recent_post.sort === 'updated' - time(datetime=date_xml(article.updated) title=_p('post.updated') + ' ' + full_date(article.updated)) #[=date(article.updated, config.date_format)] - else - time(datetime=date_xml(article.date) title=_p('post.created') + ' ' + full_date(article.date)) #[=date(article.date, config.date_format)] - - }) + time(datetime=date_xml(article.date) title=_p('post.created') + ' ' + full_date(article.date)) #[=date(article.date, config.date_format)] + - }) \ No newline at end of file diff --git a/layout/includes/widget/card_tags.pug b/layout/includes/widget/card_tags.pug index 4ca6ee6..1595ff7 100644 --- a/layout/includes/widget/card_tags.pug +++ b/layout/includes/widget/card_tags.pug @@ -1,12 +1,13 @@ -if site.tags.length - .card-widget.card-tags - .card-content - .item-headline - i.fas.fa-tags - span= _p('aside.card_tags') +if theme.aside.card_tags.enable + if site.tags.length + .card-widget.card-tags + .card-content + .item-headline + i.fas.fa-tags + span= _p('aside.card_tags') - - let tagLimit = theme.aside.card_tags.limit === 0 ? 0 : theme.aside.card_tags.limit || 40 - if theme.aside.card_tags.color - .card-tag-cloud!= cloudTags({source: site.tags, minfontsize: 1.1, maxfontsize: 1.5, limit: tagLimit, unit: 'em'}) - else - .card-tag-cloud!= tagcloud({min_font: 1.1, max_font: 1.5, amount: tagLimit , color: true, start_color: '#999', end_color: '#99a9bf', unit: 'em'}) + - let tagLimit = theme.aside.card_tags.limit === 0 ? 0 : theme.aside.card_tags.limit || 40 + if theme.aside.card_tags.color + .card-tag-cloud!= cloudTags({source: site.tags, minfontsize: 1.1, maxfontsize: 1.5, limit: tagLimit, unit: 'em'}) + else + .card-tag-cloud!= tagcloud({min_font: 1.1, max_font: 1.5, amount: tagLimit , color: true, start_color: '#999', end_color: '#99a9bf', unit: 'em'}) diff --git a/layout/includes/widget/card_webinfo.pug b/layout/includes/widget/card_webinfo.pug index ab96147..7b07218 100644 --- a/layout/includes/widget/card_webinfo.pug +++ b/layout/includes/widget/card_webinfo.pug @@ -1,31 +1,32 @@ -.card-widget.card-webinfo - .card-content - .item-headline - i.fas.fa-chart-line - span= _p('aside.card_webinfo.headline') - .webinfo - if theme.aside.card_webinfo.post_count - .webinfo-item - .item-name= _p('aside.card_webinfo.article_name') + " :" - .item-count= site.posts.length - if theme.runtimeshow.enable - .webinfo-item - .item-name= _p('aside.card_webinfo.runtime.name') + " :" - .item-count#runtimeshow(data-publishDate=date_xml(theme.runtimeshow.publish_date)) - if theme.wordcount.enable && theme.wordcount.total_wordcount - .webinfo-item - .item-name=_p('aside.card_webinfo.site_wordcount') + " :" - .item-count=totalcount(site) - if theme.busuanzi.site_uv - .webinfo-item - .item-name= _p('aside.card_webinfo.site_uv_name') + " :" - .item-count#busuanzi_value_site_uv - if theme.busuanzi.site_pv - .webinfo-item - .item-name= _p('aside.card_webinfo.site_pv_name') + " :" - .item-count#busuanzi_value_site_pv - if theme.aside.card_webinfo.last_push_date - .webinfo-item - .item-name= _p('aside.card_webinfo.last_push_date.name') + " :" - .item-count#last-push-date(data-lastPushDate=date_xml(Date.now())) +if theme.aside.card_webinfo.enable + .card-widget.card-webinfo + .card-content + .item-headline + i.fas.fa-chart-line + span= _p('aside.card_webinfo.headline') + .webinfo + if theme.aside.card_webinfo.post_count + .webinfo-item + .item-name= _p('aside.card_webinfo.article_name') + " :" + .item-count= site.posts.length + if theme.runtimeshow.enable + .webinfo-item + .item-name= _p('aside.card_webinfo.runtime.name') + " :" + .item-count#runtimeshow(data-publishDate=date_xml(theme.runtimeshow.publish_date)) + if theme.wordcount.enable && theme.wordcount.total_wordcount + .webinfo-item + .item-name=_p('aside.card_webinfo.site_wordcount') + " :" + .item-count=totalcount(site) + if theme.busuanzi.site_uv + .webinfo-item + .item-name= _p('aside.card_webinfo.site_uv_name') + " :" + .item-count#busuanzi_value_site_uv + if theme.busuanzi.site_pv + .webinfo-item + .item-name= _p('aside.card_webinfo.site_pv_name') + " :" + .item-count#busuanzi_value_site_pv + if theme.aside.card_webinfo.last_push_date + .webinfo-item + .item-name= _p('aside.card_webinfo.last_push_date.name') + " :" + .item-count#last-push-date(data-lastPushDate=date_xml(Date.now())) diff --git a/layout/includes/widget/index.pug b/layout/includes/widget/index.pug index ec2a80e..92062eb 100644 --- a/layout/includes/widget/index.pug +++ b/layout/includes/widget/index.pug @@ -1,28 +1,17 @@ #aside_content.aside_content - if theme.aside.card_author.enable - !=partial('includes/widget/card_author', {}, {cache:theme.fragment_cache}) - if theme.aside.card_announcement.enable - !=partial('includes/widget/card_announcement', {}, {cache:theme.fragment_cache}) + !=partial('includes/widget/card_author', {}, {cache:theme.fragment_cache}) + !=partial('includes/widget/card_announcement', {}, {cache:theme.fragment_cache}) .sticky_layout if is_post() if showToc include ./card_post_toc.pug - if theme.aside.card_recent_post.enable - !=partial('includes/widget/card_recent_post', {}, {cache:theme.fragment_cache}) - if theme.ad && theme.ad.aside - !=partial('includes/widget/card_ad', {}, {cache:theme.fragment_cache}) + !=partial('includes/widget/card_recent_post', {}, {cache:theme.fragment_cache}) + !=partial('includes/widget/card_ad', {}, {cache:theme.fragment_cache}) else - if theme.aside.card_recent_post.enable - !=partial('includes/widget/card_recent_post', {}, {cache:theme.fragment_cache}) - if theme.ad && theme.ad.aside - !=partial('includes/widget/card_ad', {}, {cache:theme.fragment_cache}) - if theme.newest_comments.enable - !=partial('includes/widget/card_newest_comment', {}, {cache:theme.fragment_cache}) - if theme.aside.card_categories.enable - !=partial('includes/widget/card_categories', {}, {cache:theme.fragment_cache}) - if theme.aside.card_tags.enable - !=partial('includes/widget/card_tags', {}, {cache:theme.fragment_cache}) - if theme.aside.card_archives.enable - !=partial('includes/widget/card_archives', {}, {cache:theme.fragment_cache}) - if theme.aside.card_webinfo.enable - !=partial('includes/widget/card_webinfo', {}, {cache:theme.fragment_cache}) \ No newline at end of file + !=partial('includes/widget/card_recent_post', {}, {cache:theme.fragment_cache}) + !=partial('includes/widget/card_ad', {}, {cache:theme.fragment_cache}) + !=partial('includes/widget/card_newest_comment', {}, {cache:theme.fragment_cache}) + !=partial('includes/widget/card_categories', {}, {cache:theme.fragment_cache}) + !=partial('includes/widget/card_tags', {}, {cache:theme.fragment_cache}) + !=partial('includes/widget/card_archives', {}, {cache:theme.fragment_cache}) + !=partial('includes/widget/card_webinfo', {}, {cache:theme.fragment_cache}) \ No newline at end of file diff --git a/layout/post.pug b/layout/post.pug index c57d99e..7249b9f 100644 --- a/layout/post.pug +++ b/layout/post.pug @@ -19,7 +19,7 @@ block content //- ad if theme.ad && theme.ad.post - .post-ad!=theme.ad.post + .ads-wrap!=theme.ad.post include includes/pagination.pug if theme.related_post && theme.related_post.enable diff --git a/package.json b/package.json index 180092b..d1c6640 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hexo-theme-butterfly", - "version": "3.3.0", + "version": "3.4.0-b1", "description": "A Simple and Card UI Design theme for Hexo", "main": "package.json", "scripts": { @@ -26,7 +26,7 @@ "hexo-renderer-stylus": "^2.0.1", "hexo-renderer-pug": "^1.0.0" }, - "homepage": "https://demo.jerryc.me/", + "homepage": "https://butterfly.js.org/", "author": "Jerry ", "license": "Apache-2.0" } diff --git a/scripts/helpers/aside_categories.js b/scripts/helpers/aside_categories.js index a787bad..bb83de5 100644 --- a/scripts/helpers/aside_categories.js +++ b/scripts/helpers/aside_categories.js @@ -65,11 +65,11 @@ hexo.extend.helper.register('aside_categories', function (categories, options) { result += '' - result += '' - if (child) { result += `` } + + result += '' } }) } diff --git a/scripts/tag/gallery.js b/scripts/tag/gallery.js index a285008..6bec4c4 100644 --- a/scripts/tag/gallery.js +++ b/scripts/tag/gallery.js @@ -20,7 +20,7 @@ function galleryGroup (args) { return `