From 2bab020d4875972a29bb5595e47354c8f47098cd Mon Sep 17 00:00:00 2001 From: lensferno Date: Tue, 27 Jun 2023 21:32:04 +0800 Subject: [PATCH] footer --- _config.yml | 7 +++- layout/includes/_partials/data_row.pug | 10 ++--- layout/includes/_partials/footer.pug | 26 +++++++++++++ .../includes/_partials/information_card.pug | 18 +++++---- .../_partials/post_list/paginator.pug | 13 +++++++ layout/includes/layout.pug | 24 ++++++------ source/css/_partials/footer/footer.styl | 39 +++++++++++++++++++ .../_partials/footer/left_declaration.styl | 3 ++ source/css/_partials/header/header.styl | 2 +- source/css/_partials/index.styl | 10 ++--- source/css/_partials/post_list/paginator.styl | 14 +++++++ source/css/_partials/post_list/post_item.styl | 1 + source/css/common.styl | 11 +++++- source/js/pagination.js | 0 14 files changed, 145 insertions(+), 33 deletions(-) create mode 100644 source/css/_partials/footer/footer.styl create mode 100644 source/css/_partials/footer/left_declaration.styl create mode 100644 source/js/pagination.js diff --git a/_config.yml b/_config.yml index 66c70b8..4cd2459 100644 --- a/_config.yml +++ b/_config.yml @@ -35,6 +35,11 @@ social: Twitter: lensfrex || https://www.twitter.com Bilibili: lensfrex || https://bilibili.com +beginTime: "2022·02·23" + lazyload: enable: true - \ No newline at end of file + +icp: + text: 桂ICP备2022001653号 + link: https://beian.miit.gov.cn/ \ No newline at end of file diff --git a/layout/includes/_partials/data_row.pug b/layout/includes/_partials/data_row.pug index 87a0bd7..3de2ddc 100644 --- a/layout/includes/_partials/data_row.pug +++ b/layout/includes/_partials/data_row.pug @@ -1,8 +1,8 @@ -mixin data_row(name, value, target_href) +mixin data_row(data) .data-row - span.data-name=name - if target_href + span.data-name= data.name + if data.target_link span.data-value - a(href=target_href target='_balnk')=value + a(href=data.target_link target='_balnk')= data.value else - span.data-value=value + span.data-value(id=data.value_id)= data.value diff --git a/layout/includes/_partials/footer.pug b/layout/includes/_partials/footer.pug index e69de29..17d0218 100644 --- a/layout/includes/_partials/footer.pug +++ b/layout/includes/_partials/footer.pug @@ -0,0 +1,26 @@ +include ./button.pug + +#footer-content-base + .footer-content + include ./left_declaration.pug + .footer-info + .left + span.bold Framework + br + a.small(href="https://github.com/hexojs/hexo" target="_blank") Hexo + br + span.bold Theme + br + a.small(href="https://github.com/lensferno/hexo-theme-yorha" target="_blank") YoRHa + br + br + a.small.icp(href=theme.icp.link)= theme.icp.text + .v-line + .right + span.bold= 'By ' + a(href='/')= config.author + br + br + span.time= theme.beginTime + span - + span.time= date(Date.now(), 'YYYY·MM·DD') diff --git a/layout/includes/_partials/information_card.pug b/layout/includes/_partials/information_card.pug index 9b44590..57377e3 100644 --- a/layout/includes/_partials/information_card.pug +++ b/layout/includes/_partials/information_card.pug @@ -14,10 +14,10 @@ mixin information_card(...extendData) span.sign= config.description hr - +data_row("文章", site.posts.length) - +data_row("页面", site.pages.length) - +data_row("标签", site.tags.length) - +data_row("分类", site.categories.length) + +data_row({name: "文章", value: site.posts.length}) + +data_row({name: "页面", value: site.pages.length}) + +data_row({name: "标签", value: site.tags.length}) + +data_row({name: "分类", value: site.categories.length}) if theme.social hr @@ -25,14 +25,16 @@ mixin information_card(...extendData) - const splitValue = value.split('||') - const displayValue = splitValue[0] - const link = splitValue[1] - +data_row(name, displayValue, link) + +data_row({name: name, value: displayValue, target_link: link}) hr if extendData each data in extendData - +data_row(data.name, data.value) + +data_row({name: data.name, value: data.value}) - +data_row("运行时间", "421天") - + +data_row({name: "运行时间", value: "432天", value_id: "run_time"}) + script. + const runTime = document.getElementById("run_time"); + hr span.no-error-declaration NO ERROR diff --git a/layout/includes/_partials/post_list/paginator.pug b/layout/includes/_partials/post_list/paginator.pug index aef722d..f36d0e0 100644 --- a/layout/includes/_partials/post_list/paginator.pug +++ b/layout/includes/_partials/post_list/paginator.pug @@ -15,4 +15,17 @@ mixin paginator_button(prev, disabled, link) - const is_first = page.prev == 0 - const is_last = page.next == 0 +paginator_button(true, is_first, url_for(page.prev_link)) + input.page-jump-input( + type= "text" + placeholder= page.current + oninput= "this.value=this.value.replace(/\\D/g, '')" + onpaste= "this.value=this.value.replace(/\\D/g, '')" + onkeypress= `if(event.charCode == 13) jmp(this.value, ${page.total}, '/${config.pagination_dir}/')` + ) + script. + function jmp(page, max_page, dir) { + if(page >= 0 && page <= max_page) { + document.location = (page == '1') ? '/' : dir + page; + } + } +paginator_button(false, is_last, url_for(page.next_link)) \ No newline at end of file diff --git a/layout/includes/layout.pug b/layout/includes/layout.pug index ec5e093..af24e4f 100644 --- a/layout/includes/layout.pug +++ b/layout/includes/layout.pug @@ -18,24 +18,26 @@ html(lang=config.language) each url in theme.stylesheets link(rel='stylesheet', href=url) body - #container.container + #container.container header#header.header - .header-box - include ./_partials/header.pug + include ./_partials/header.pug .bottom-declaration .bottom-declaration-line .bottom-declaration-dotted - main#main.main - .main-box - #content.content - block content + main#main.main + #content.content + block content - footer#footer.footer - .footer-box - include ./_partials/footer.pug - //- 这这段一定要放在body结束前,否则lazyload不生效 + footer#footer.footer + include ./_partials/footer.pug + + .bottom-declaration + .bottom-declaration-line + .bottom-declaration-dotted + + //- 这段script一定要放在body结束前,否则lazyload不生效 script(src="/js/lazyload.min.js") script. window.lazyLoad = new LazyLoad({ diff --git a/source/css/_partials/footer/footer.styl b/source/css/_partials/footer/footer.styl new file mode 100644 index 0000000..925dd04 --- /dev/null +++ b/source/css/_partials/footer/footer.styl @@ -0,0 +1,39 @@ +.footer-content + display: flex + flex-direction: row + gap: 16px + height: auto + justify-content: left + width: 100% + background-color: rgba(231, 225, 199, 0.75) + color: rgb(74, 71, 62) + .footer-info + padding: 8px 0 + display: flex + flex-direction: row + gap: 24px + justify-content: left + .v-line + margin-top: 2px + margin-bottom: 2px + a + text-decoration: none + color: rgb(74, 71, 62) + a:hover + text-decoration: underline + span + font-size: 16px + .bold + font-weight: bold + font-size: 20px + .small + font-size: 14px + .normal + font-size: 16px + .medium + font-size: 18px + .icp + margin-top: 8px + line-height: 1em + .time + font-weight: bold diff --git a/source/css/_partials/footer/left_declaration.styl b/source/css/_partials/footer/left_declaration.styl new file mode 100644 index 0000000..56f9904 --- /dev/null +++ b/source/css/_partials/footer/left_declaration.styl @@ -0,0 +1,3 @@ +footer .left-declaration .declaration + background-color: rgb(74, 71, 62) + \ No newline at end of file diff --git a/source/css/_partials/header/header.styl b/source/css/_partials/header/header.styl index 4e5570c..812a0e1 100644 --- a/source/css/_partials/header/header.styl +++ b/source/css/_partials/header/header.styl @@ -1,4 +1,4 @@ -.menu-items-container +header .menu-items-container display: flex; flex-direction: row; gap: 16px; diff --git a/source/css/_partials/index.styl b/source/css/_partials/index.styl index efcbfe8..d3ece0e 100644 --- a/source/css/_partials/index.styl +++ b/source/css/_partials/index.styl @@ -8,11 +8,11 @@ display: flex; flex-direction: row; .post-list - background-color: rgba(231, 225, 199, 0.5); - height: auto - display: flex; - flex-direction: column; - gap: 16px; + background-color: rgba(231, 225, 199, 0.5) + height: fit-content + display: flex + flex-direction: column + gap: 16px width: 100% // overflow-y: scroll overflow-x: hidden diff --git a/source/css/_partials/post_list/paginator.styl b/source/css/_partials/post_list/paginator.styl index 3509a5e..6bae351 100644 --- a/source/css/_partials/post_list/paginator.styl +++ b/source/css/_partials/post_list/paginator.styl @@ -9,6 +9,20 @@ font-size: 18px font-weight: bold .right + input.page-jump-input + width: 32px + height: 32px + border: none + outline: none + text-align: center + background-color: rgb(180, 175, 154) + color: rgb(74, 71, 62) + font-size: 18px + user-select: none + &::-webkit-input-placeholder + color: rgb(74, 71, 62); + &::-moz-placeholder + color: rgb(74, 71, 62); .paginator-btn-box display: flex flex-direction: row diff --git a/source/css/_partials/post_list/post_item.styl b/source/css/_partials/post_list/post_item.styl index aef6875..a9494dd 100644 --- a/source/css/_partials/post_list/post_item.styl +++ b/source/css/_partials/post_list/post_item.styl @@ -11,6 +11,7 @@ min-height: 144px; &:hover background-color: $light + filter: drop-shadow(0px 0px 2px rgb(74, 71, 62)); .no-cover transition: all 0.2s linear 0s !important filter: invert(100%) diff --git a/source/css/common.styl b/source/css/common.styl index fdf7b32..bfb384e 100644 --- a/source/css/common.styl +++ b/source/css/common.styl @@ -17,10 +17,10 @@ body > * ::selection color: rgb(231, 225, 199) #container - padding: 1.5% 2% 2% 2% + padding: 1.5% 2% 1% 2% #main - margin-top: 2em + margin: 2em 0 span::selection background-color: rgb(74, 71, 62) @@ -65,6 +65,13 @@ img &[data-src].error filter: none +.v-line + float: left; + width: 1.3px; + height: auto; + background: rgba(0, 0, 0, 0.16); + @import '_partials/header/*' +@import '_partials/footer/*' @import '_partials/post_list/*' @import '_partials/*' \ No newline at end of file diff --git a/source/js/pagination.js b/source/js/pagination.js new file mode 100644 index 0000000..e69de29