diff --git a/_config.yml b/_config.yml index 0f70126..fc2606a 100644 --- a/_config.yml +++ b/_config.yml @@ -254,12 +254,15 @@ noticeOutdate: # Footer Settings # -------------------------------------- footer: + nav: owner: enable: true - since: 2019 - custom_text: + since: 2025 # Copyright of theme and framework - copyright: true + copyright: + enable: true + version: true + custom_text: # -------------------------------------- # Aside Settings @@ -399,6 +402,9 @@ rightside_item_order: # Default: toc,chat,comment show: +# Animation for the bottom right config button +rightside_config_animation: true + # -------------------------------------- # Global Settings # -------------------------------------- diff --git a/layout/includes/footer.pug b/layout/includes/footer.pug index 0f3dbe3..71490d2 100644 --- a/layout/includes/footer.pug +++ b/layout/includes/footer.pug @@ -1,19 +1,39 @@ -#footer-wrap - if theme.footer.owner.enable - - const currentYear = new Date().getFullYear() - - const sinceYear = theme.footer.owner.since - .copyright - if sinceYear && sinceYear != currentYear - != `©${sinceYear} - ${currentYear} By ${config.author}` - else - != `©${currentYear} By ${config.author}` - if theme.footer.copyright - - const v = getVersion() - .framework-info - span= _p('footer.framework') + ' ' - a(href='https://hexo.io')= `Hexo ${v.hexo}` - span.footer-separator | - span= _p('footer.theme') + ' ' - a(href='https://github.com/jerryc127/hexo-theme-butterfly')= `Butterfly ${v.theme}` +- const { nav, owner, copyright, custom_text } = theme.footer + +if nav + .footer-flex + for block in nav + .footer-flex-items(style=`${ block.width ? 'flex-grow:' + block.width : '' }`) + for blockItem in block.content + .footer-flex-item + .footer-flex-title= blockItem.title + .footer-flex-content + for subitem in blockItem.item + if subitem.html + div!= subitem.html + else if subitem.url + a(href=url_for(subitem.url), target='_blank' title=subitem.title)= subitem.title + else if subitem.title + div!= subitem.title +.footer-other + .footer-copyright + if owner.enable + - const currentYear = new Date().getFullYear() + - const sinceYear = owner.since + span.copyright + if sinceYear && sinceYear != currentYear + != `©${sinceYear} - ${currentYear} By ${config.author}` + else + != `©${currentYear} By ${config.author}` + if copyright.enable + - const v = copyright.version ? getVersion() : false + span.framework-info + if owner.enable && nav + span.footer-separator | + span= _p('footer.framework') + ' ' + a(href='https://hexo.io')= `Hexo${ v ? ' ' + v.hexo : '' }` + span.footer-separator | + span= _p('footer.theme') + ' ' + a(href='https://github.com/jerryc127/hexo-theme-butterfly')= `Butterfly${ v ? ' ' + v.theme : '' }` if theme.footer.custom_text - .footer_custom_text!= theme.footer.custom_text \ No newline at end of file + .footer_custom_text!= theme.footer.custom_text diff --git a/layout/includes/rightside.pug b/layout/includes/rightside.pug index b7608ad..11b1c76 100644 --- a/layout/includes/rightside.pug +++ b/layout/includes/rightside.pug @@ -1,4 +1,5 @@ - const { readmode, translate, darkmode, aside, chat } = theme + mixin rightsideItem(array) each item in array case item @@ -30,30 +31,22 @@ mixin rightsideItem(array) a#to_comment(href="#post-comment" title=_p("rightside.scroll_to_comment")) i.fas.fa-comments +- const { enable, hide, show } = theme.rightside_item_order +- const hideArray = enable && hide ? hide.split(',') : ['readmode','translate','darkmode','hideAside'] +- const showArray = enable && show ? show.split(',') : ['toc','chat','comment'] +- const needCogBtn = (enable && hide) || (!enable && ((globalPageType === 'post' && (readmode || translate.enable || (darkmode.enable && darkmode.button))) || (translate.enable || (darkmode.enable && darkmode.button)))) + #rightside - - const { enable, hide, show } = theme.rightside_item_order - - const hideArray = enable ? hide && hide.split(',') : ['readmode','translate','darkmode','hideAside'] - - const showArray = enable ? show && show.split(',') : ['toc','chat','comment'] - - #rightside-config-hide - if hideArray + if hideArray.length +rightsideItem(hideArray) - #rightside-config-show - if enable - if hide - button#rightside-config(type="button" title=_p("rightside.setting")) - i.fas.fa-cog.fa-spin - else - if globalPageType === 'post' - if (readmode || translate.enable || (darkmode.enable && darkmode.button)) - button#rightside-config(type="button" title=_p("rightside.setting")) - i.fas.fa-cog.fa-spin - else if translate.enable || (darkmode.enable && darkmode.button) - button#rightside-config(type="button" title=_p("rightside.setting")) - i.fas.fa-cog.fa-spin - if showArray + #rightside-config-show + if needCogBtn + button#rightside-config(type="button" title=_p("rightside.setting")) + i.fas.fa-cog(class=theme.rightside_config_animation ? 'fa-spin' : '') + + if showArray.length +rightsideItem(showArray) button#go-up(type="button" title=_p("rightside.back_to_top")) diff --git a/layout/includes/third-party/abcjs/abcjs.pug b/layout/includes/third-party/abcjs/abcjs.pug index 9de2b97..5778310 100644 --- a/layout/includes/third-party/abcjs/abcjs.pug +++ b/layout/includes/third-party/abcjs/abcjs.pug @@ -1,8 +1,8 @@ script. - (function() { - const abcjsInit = function() { - const abcjsFn = function() { - setTimeout(function() { + (() = { + const abcjsInit = () => { + const abcjsFn = () => { + setTimeout(() => { const sheets = document.querySelectorAll(".abc-music-sheet") for (let i = 0; i < sheets.length; i++) { const ele = sheets[i] diff --git a/layout/includes/third-party/pjax.pug b/layout/includes/third-party/pjax.pug index 94ec038..0f868d6 100644 --- a/layout/includes/third-party/pjax.pug +++ b/layout/includes/third-party/pjax.pug @@ -60,9 +60,9 @@ script. document.addEventListener('pjax:error', e => { if (e.request.status === 404) { const usePjax = !{theme.pjax && theme.pjax.enable} - !{theme.error_404 && theme.error_404.enable} + !{theme.error_404 && theme.error_404.enable} ? (usePjax ? pjax.loadUrl('!{url_for("/404.html")}') : window.location.href = '!{url_for("/404.html")}') : window.location.href = e.request.responseURL } }) - })() + })() \ No newline at end of file diff --git a/layout/includes/third-party/subtitle.pug b/layout/includes/third-party/subtitle.pug index 0d0c523..8dbb534 100644 --- a/layout/includes/third-party/subtitle.pug +++ b/layout/includes/third-party/subtitle.pug @@ -87,7 +87,7 @@ case source when 3 script. function subtitleType () { - btf.getScript('https://sdk.jinrishi8ci.com/v2/browser/jinrishici.js') + btf.getScript('https://sdk.jinrishici.com/v2/browser/jinrishici.js') .then(() => { jinrishici.load(result => { if (result && result.data && result.data.content) { diff --git a/package.json b/package.json index 54e3e65..3a3aaa6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hexo-theme-butterfly", - "version": "5.3.5", + "version": "5.4.0-b1", "description": "A Simple and Card UI Design theme for Hexo", "main": "package.json", "scripts": { diff --git a/scripts/events/merge_config.js b/scripts/events/merge_config.js index eb27857..e6bf36d 100644 --- a/scripts/events/merge_config.js +++ b/scripts/events/merge_config.js @@ -119,12 +119,16 @@ hexo.extend.filter.register('before_generate', () => { message_next: 'days since the last update, the content of the article may be outdated.' }, footer: { + nav: null, owner: { enable: true, - since: 2019 + since: 2024 }, - custom_text: null, - copyright: true + copyright: { + enable: true, + version: true + }, + custom_text: null }, aside: { enable: true, @@ -223,6 +227,7 @@ hexo.extend.filter.register('before_generate', () => { hide: null, show: null }, + rightside_config_animation: true, anchor: { auto_update: false, click_to_scroll: false diff --git a/scripts/helpers/page.js b/scripts/helpers/page.js index 9084919..9cdee3f 100644 --- a/scripts/helpers/page.js +++ b/scripts/helpers/page.js @@ -81,7 +81,7 @@ hexo.extend.helper.register('findArchivesTitle', function (page, menu, date) { return loop(menu) || defaultTitle }) -hexo.extend.helper.register('getBgPath', path => { +hexo.extend.helper.register('getBgPath', function(path) { if (!path) return '' const absoluteUrlPattern = /^(?:[a-z][a-z\d+.-]*:)?\/\//i @@ -91,7 +91,7 @@ hexo.extend.helper.register('getBgPath', path => { if (colorPattern.test(path)) { return `background-color: ${path};` } else if (absoluteUrlPattern.test(path) || relativeUrlPattern.test(path)) { - return `background-image: url(${path});` + return `background-image: url(${this.url_for(path)});` } else { return `background: ${path};` } diff --git a/source/css/_layout/footer.styl b/source/css/_layout/footer.styl index b47a04d..cb806e9 100644 --- a/source/css/_layout/footer.styl +++ b/source/css/_layout/footer.styl @@ -13,17 +13,16 @@ background-color: var(--mark-bg) content: '' -#footer-wrap - position: relative - padding: 40px 20px - color: var(--light-grey) - text-align: center + & > * + position: relative + color: var(--light-grey) a color: var(--light-grey) + transition: all .3s ease-in-out &:hover - text-decoration: underline + color: $light-blue .footer-separator margin: 0 4px @@ -33,3 +32,56 @@ max-height: 1.4em width: auto vertical-align: text-bottom + + .footer-flex + display: flex + flex-direction: row + flex-wrap: wrap + justify-content: space-between + margin: 0 auto + padding: 40px 60px + max-width: 1200px + width: 100% + text-align: left + gap: 13px + + +maxWidth768() + padding: 30px + gap: 10px + + .footer-flex-items + flex-shrink: 0 + min-width: 100px + text-align: left + white-space: nowrap + + .footer-flex-title + margin-bottom: 5px + white-space: nowrap + font-weight: 600 + font-size: 1.4em + + .footer-flex-item + margin: 10px 0 + white-space: nowrap + + a + display: block + white-space: nowrap + + .footer-other + padding: 40px 20px + width: 100% + text-align: center + + if hexo-config('footer.nav') + padding: 10px 8px + background-color: rgba(0, 0, 0, .1) + + .copyright, + .framework-info, + .footer_custom_text + font-size: .9em + else + .framework-info + display: block \ No newline at end of file