Skip to content

Commit

Permalink
✨ 增加打印样式
Browse files Browse the repository at this point in the history
  • Loading branch information
Bluemangoo authored and zkqiang committed Jun 28, 2023
1 parent b67a247 commit 3abe246
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 5 deletions.
2 changes: 1 addition & 1 deletion layout/_partials/header.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var banner_img_height = parseFloat(page.banner_img_height || theme.index.banner_img_height)
%>

<div class="header-inner" style="height: <%= banner_img_height %>vh;">
<div class="header-inner print-hide" style="height: <%= banner_img_height %>vh;">
<%- partial('_partials/header/navigation') %>
<%- partial('_partials/header/banner') %>
</div>
2 changes: 1 addition & 1 deletion layout/_partials/post/copyright.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<% if (['BY', 'BY-SA', 'BY-ND', 'BY-NC', 'BY-NC-SA', 'BY-NC-ND'].indexOf(license) !== -1) { %>
<% var items = license.split('-') %>
<% for (var idx = 0; idx < items.length; idx++) { %>
<a target="_blank" href="https://creativecommons.org/licenses/<%= license.toLowerCase() %>/4.0/">
<a class="print-no-link" target="_blank" href="https://creativecommons.org/licenses/<%= license.toLowerCase() %>/4.0/">
<span class="hint--top hint--rounded" aria-label="<%- __('post.copyright.' + items[idx]) %>">
<i class="iconfont icon-<%= items[idx].toLowerCase() %>"></i>
</span>
Expand Down
2 changes: 1 addition & 1 deletion layout/_partials/post/meta-bottom.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="post-meta">
<i class="iconfont icon-tags"></i>
<% page.tags.each(function(tag) { %>
<a href="<%= url_for(tag.path) %>">#<%- tag.name %></a>
<a href="<%= url_for(tag.path) %>" class="print-no-link">#<%- tag.name %></a>
<% }) %>
</div>
<% } %>
Expand Down
2 changes: 1 addition & 1 deletion layout/layout.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var colorSchema = theme.dark_mode && theme.dark_mode.enable && theme.dark_mode.d

<% if (theme.scroll_top_arrow.enable) { %>
<a id="scroll-top-button" aria-label="TOP" href="#" role="button">
<i class="iconfont icon-arrowup" aria-hidden="true"></i>
<i class="iconfont icon-arrowup print-hide" aria-hidden="true"></i>
</a>
<% } %>

Expand Down
3 changes: 2 additions & 1 deletion layout/post.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ page.banner_mask_alpha = page.banner_mask_alpha || theme.post.banner_mask_alpha
<div id="board">
<article class="post-content mx-auto">
<!-- SEO header -->
<h1 style="display: none"><%= page.subtitle || page.title %></h1>
<h1 class="print-show" id="seo-header"><%= page.subtitle || page.title %></h1>
<hr class="print-show">
<% if (theme.post.updated.enable && theme.post.updated && compare_date(page.date, page.updated)) { %>
<p class="note note-<%= theme.post.updated.note_class || 'info' %>">
<% if (theme.post.updated.relative) { %>
Expand Down
15 changes: 15 additions & 0 deletions source/css/_pages/_base/print.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@media print
a:not([href^='#']):not([href^='javascript:']):not(.print-no-link)::after
content ' (' attr(href) ')'
font-size 80%
color #57606a

.print-hide
display: none !important

@media not print
.print-show
display none

#seo-header
display none
7 changes: 7 additions & 0 deletions source/css/_pages/_post/post-page.styl
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@
-webkit-transform translateX(0)
transform translateX(0)

#seo-header
height auto;
color: var(--post-heading-color);
font-weight: bold;
margin-bottom: 0.75em;
margin-top: 2em;

.custom, #comments
margin-top 2rem

Expand Down

0 comments on commit 3abe246

Please sign in to comment.