Skip to content

Commit

Permalink
Merge pull request #347 from XPoet/dev
Browse files Browse the repository at this point in the history
Release new version
  • Loading branch information
XPoet authored Jul 15, 2024
2 parents 8db1f7d + 81f2c77 commit 1a7696b
Show file tree
Hide file tree
Showing 25 changed files with 670 additions and 280 deletions.
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ post:
enable: false # Option values: true | false
img_link: # Image link for the payment QR code
text: # Custom reward text, Can be null
icon: # Custom reward icon, Can be null


# ---------------------------------------------------------------------------------------
Expand Down
90 changes: 63 additions & 27 deletions layout/_partial/header.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ for (const key in origin_h_menu_nav_object) {
<header class="header-wrapper<%= s_fs_enable === true && is_home() ? ' transparent-1' : '' %>">
<div class="border-box header-content<%- (s_fs_enable === true && is_home() && !page.prev) ? ' has-first-screen' : '' %>">
<div class="left border-box">
<div class="left flex-start border-box">
<% if (bi_logo) { %>
<a class="logo-image border-box" href="<%- url_for('/') %>">
<%- image_tag(bi_logo) %>
Expand All @@ -25,33 +25,45 @@ for (const key in origin_h_menu_nav_object) {
</div>
<div class="right border-box">
<div class="pc">
<ul class="menu-list">
<div class="pc border-box">
<ul class="menu-list border-box">
<% for (const i in h_menu_nav_object) { %>
<%
const temp_menu_list = h_menu_nav_object[i]?.split('||')
const nav_path = temp_menu_list[0]?.trim()?.toLowerCase()
const nav_icon = temp_menu_list[1]?.trim()?.toLowerCase()
%>
<li class="menu-item">
<a class="<%- is_current(nav_path) ? 'active' : '' %>"
href="<%- url_for(nav_path) %>"
>
<% if (nav_icon) { %>
<i class="menu-icon <%= nav_icon %>"></i>
<% const { path, icon, name, children } = getMenuItemObj(h_menu_nav_object, i) %>
<li class="menu-item flex-start border-box<%- children.length ? ' has-sub-menu' : '' %><%- path && is_current(path) && !children.length ? ' active' : '' %>">
<a class="menu-text-color border-box" href="<%- path && !children.length ? url_for(path) : 'javascript:void(0);' %>">
<% if (icon) { %>
<i class="menu-text-color menu-icon <%= icon %>"></i>
<% } %>
<%= __(name).toUpperCase() %>
<% if (children.length) { %>
<i class="menu-text-color collapse-icon fa-solid fa-angle-down"></i>
<% } %>
<%= __(i.toLowerCase()).toUpperCase() %>
</a>
<% if (children.length) { %>
<ul class="sub-menu-list border-box">
<% for (const smi of children) { %>
<% const { path: p2, icon: i2, name: n2 } = parseMenuItem(smi) %>
<li class="sub-menu-item border-box <%- is_current(p2) ? ' active' : '' %>">
<a class="menu-text-color border-box flex-start" href="<%- url_for(p2) %>">
<% if (i2) { %>
<i class="menu-text-color sub-menu-icon <%= i2 %>"></i>
<% } %>
<%= __(n2).toUpperCase() %>
</a>
</li>
<% } %>
</ul>
<% } %>
</li>
<% } %>
<% if (local_search_enable === true) { %>
<li class="menu-item search search-popup-trigger">
<i class="fas search fa-search"></i>
<i class="menu-text-color fas search fa-search"></i>
</li>
<% } %>
</ul>
</div>
<div class="mobile">
<div class="mobile border-box flex-start">
<% if (local_search_enable === true) { %>
<div class="icon-item search search-popup-trigger"><i class="fas fa-search"></i></div>
<% } %>
Expand All @@ -63,16 +75,40 @@ for (const key in origin_h_menu_nav_object) {
</div>
<div class="header-drawer">
<ul class="drawer-menu-list">
<% for (let i in h_menu_nav_object) { %>
<%
const temp_menu_list2 = h_menu_nav_object[i]?.split('||')
const nav_path2 = temp_menu_list2[0]?.trim()?.toLowerCase()
%>
<li class="drawer-menu-item flex-center">
<a class="<%- is_current(nav_path2) ? 'active' : '' %>"
href="<%- url_for(nav_path2) %>"
><%= __(i.toLowerCase()).toUpperCase() %></a>
<ul class="drawer-menu-list border-box">
<% for (const i in h_menu_nav_object) { %>
<% const { path, icon, name, children } = getMenuItemObj(h_menu_nav_object, i) %>
<li class="drawer-menu-item border-box<%- children.length ? ' has-sub-menu' : ' not-sub-menu' %><%- path && is_current(path) && !children.length ? ' active' : '' %>">
<label class="drawer-menu-label border-box">
<a class="drawer-menu-text-color left-side flex-start border-box" href="<%- path && !children.length ? url_for(path) : 'javascript:void(0);' %>">
<% if (icon) { %>
<span class="menu-icon-wrap border-box flex-center">
<i class="drawer-menu-text-color menu-icon <%= icon %>"></i>
</span>
<% } %>
<%= __(name).toUpperCase() %>
</a>
<% if (children.length) { %>
<i class="right-side collapse-icon fa-solid fa-angle-left"></i>
<% } %>
</label>
<% if (children.length) { %>
<ul class="drawer-sub-menu-list border-box">
<% for (const smi of children) { %>
<% const { path: p2, icon: i2, name: n2 } = parseMenuItem(smi) %>
<li class="sub-menu-item border-box<%- is_current(p2) ? ' active' : '' %>">
<a class="drawer-menu-text-color border-box flex-start" href="<%- url_for(p2) %>">
<% if (i2) { %>
<span class="sub-menu-icon-wrap border-box flex-center">
<i class="drawer-menu-text-color sub-menu-icon <%= i2 %>"></i>
</span>
<% } %>
<%= __(n2).toUpperCase() %>
</a>
</li>
<% } %>
</ul>
<% } %>
</li>
<% } %>
</ul>
Expand Down
20 changes: 14 additions & 6 deletions layout/_partial/paginator.ejs
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
<% if (page.total > 1) { %>
<div class="paginator border-box flex-center">
<div class="btn-wrap<%= page_info.prev ? ' allowed' : '' %>">
<a class="jump-btn"
<div class="border-box first-page paginator-btn <%= page_info.prev ? 'allowed' : 'not-allow' %>">
<a class="border-box"><i class="fa-solid fa-angle-double-left"></i></a>
</div>
<div class="border-box paginator-btn<%= page_info.prev ? ' allowed' : '' %>">
<a class="border-box"
href="<%- url_for(page_info.prev_link) %>"
><i class="fa-solid fa-chevron-left"></i></a>
</div>
<div class="page-number-box border-box flex-center">
<input class="page-number-input border-box base-color-size"
<input class="page-number-input border-box base-style"
type="number"
value="<%- page.current %>"
min="1"
max="<%- page.total %>"
><span class="delimiter base-color-size">/</span><span class="base-color-size"><%- page.total %></span>
/><span class="delimiter base-style">/</span><span class="base-style"><%- page.total %></span>
</div>
<div class="btn-wrap<%= page_info.next ? ' allowed' : '' %>">
<a class="jump-btn"
<div class="border-box paginator-btn<%= page_info.next ? ' allowed' : '' %>">
<a class="border-box"
href="<%- url_for(page_info.next_link) %>"
><i class="fa-solid fa-chevron-right"></i></a>
</div>
<div class="border-box last-page paginator-btn <%= page_info.next ? 'allowed' : 'not-allow' %>">
<a class="border-box"><i class="fa-solid fa-angle-double-right"></i></a>
</div>
</div>
<% } %>

Expand Down
13 changes: 8 additions & 5 deletions layout/_partial/post/reward-author.ejs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<%
const { img_link, text, icon } = theme?.post?.reward || {}
%>
<div class="reward-author-container border-box flex-center">
<div class="reward-btn keep-button border-box flex-center tooltip tooltip-img"
data-tooltip-content="<%= theme?.post?.reward?.text || __('post.reward') %>"
data-tooltip-img-url="<%= theme?.post?.reward?.img_link %>"
<div class="reward-btn border-box flex-center tooltip tooltip-img"
data-tooltip-img-url="<%= img_link %>"
data-tooltip-img-trigger="click"
data-tooltip-img-style="top: -8px;"
data-tooltip-img-style="top: -6px;"
>
<i class="fa-solid fa-hand-holding-heart"></i>
<i class="<%= icon || 'fa-solid fa-gift' %>"></i>&nbsp;<%= (text || __('post.reward')).toUpperCase() %>
</div>
</div>
15 changes: 10 additions & 5 deletions layout/_partial/scripts.ejs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<!-- common -->
<%
const { links: links_data, photos: photos_data, tools: tools_data } = theme?.source_data
const page_template = page?.template?.toLowerCase()
%>
<!-- common js -->
<%- __js([
'js/utils.js',
'js/header-shrink.js',
Expand All @@ -9,7 +14,7 @@
'js/libs/anime.min.js'
]) %>
<!-- local-search -->
<!-- local search -->
<% if (theme?.local_search?.enable === true) { %>
<%- __js('js/local-search.js') %>
<% } %>
Expand Down Expand Up @@ -52,17 +57,17 @@
<% } %>
<!-- links page -->
<% if (is_current('/links') || is_current('/link')) { %>
<% if ((page_template === 'links' || page_template === 'link') && links_data) { %>
<%- __js('js/page/links-page.js') %>
<% } %>
<!-- photos page -->
<% if (is_current('/photos') || is_current('/photo')) { %>
<% if ((page_template === 'photos' || page_template === 'photo') && photos_data) { %>
<%- __js('js/page/photos-page.js') %>
<% } %>
<!-- tools page -->
<% if (is_current('/tools') || is_current('/tool')) { %>
<% if ((page_template === 'tools' || page_template === 'tool') && tools_data) { %>
<%- __js('js/page/tools-page.js') %>
<% } %>
</div>
Expand Down
10 changes: 7 additions & 3 deletions layout/_partial/side-tools.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
<i class="fas fa-search-minus"></i>
</li>

<li class="tools-item tool-toggle-theme-mode flex-center">
<i class="fas fa-moon"></i>
</li>
<!-- toggle mode -->
<% if (theme?.base_info?.mode !== 'dark' && theme?.base_info?.mode !== 'light') { %>
<li class="tools-item tool-toggle-theme-mode flex-center">
<i class="fas fa-moon"></i>
</li>
<% } %>
<!-- rss -->
<% if (theme?.rss?.enable === true && config.feed) { %>
Expand All @@ -24,6 +27,7 @@
</li>
<% } %>
<!-- to bottom -->
<li class="tools-item tool-scroll-to-bottom flex-center">
<i class="fas fa-arrow-down"></i>
</li>
Expand Down
8 changes: 5 additions & 3 deletions layout/_template/friends-link.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
<a class="a-wrap border-box" href="<%= f?.link %>">
<div class="avatar border-box flex-center">
<i class="icon fas fa-eye-slash"></i>
<img src="<%- url_for(f?.avatar) %>"
onerror="this.style.display='none'"
>
<% if (f?.avatar) { %>
<img src="<%- url_for(f.avatar) %>"
onerror="this.style.display='none'"
>
<% } %>
</div>
<div class="details border-box text-ellipsis">
<div class="name border-box text-ellipsis"><%= f?.name %></div>
Expand Down
23 changes: 17 additions & 6 deletions layout/_template/page-template.ejs
Original file line number Diff line number Diff line change
@@ -1,39 +1,50 @@
<%
const page_title = page?.title?.toLowerCase()
const page_template = page?.template?.toLowerCase()
const use_page_template = page?.use_template !== false
const { links: links_data, photos: photos_data, tools: tools_data } = theme?.source_data
const has_page_cover = page?.page_cover ? 'has-page-cover' : ''
let current_page_data = null
let current_page_template = null
let keep_container = 'keep-container'
if (page_title === 'links' || page_title === 'link') {
if (page_template === 'links' || page_template === 'link') {
current_page_data = links_data
current_page_template = 'friends-link'
}
if (page_title === 'photos' || page_title === 'photo') {
if (page_template === 'photos' || page_template === 'photo') {
current_page_data = photos_data
current_page_template = 'photo-album'
}
if (page_title === 'tools' || page_title === 'tool') {
if (page_template === 'tools' || page_template === 'tool') {
current_page_data = tools_data
current_page_template = 'tools-nav'
if (current_page_data) { keep_container = '' }
}
const page_cover = page?.page_cover || ''
const has_page_cover = page_cover ? 'has-page-cover' : ''
const page_cover_title = page?.page_cover_title || ''
const page_cover_height = page?.page_cover_height ? page?.page_cover_height + 'px' : '200px'
%>
<div class="fade-in-down-animation">
<div class="page-template-container border-box <%= keep_container %> <%= has_page_cover %>">
<!-- page top -->
<% if (page?.page_cover) { %>
<div class="page-template-top border-box"
style="height: <%= page?.page_cover_height ? page?.page_cover_height + 'px' : '200px' %>"
style="height: <%= page_cover_height %>"
>
<img class="page-cover" src="<%- url_for(page.page_cover) %>"
<img class="page-cover" src="<%- url_for(page_cover) %>"
onerror="this.style.display = 'none'"
>
<% if (page_cover_title) { %>
<span class="page-cover-title">
<%= page_cover_title %>
</span>
<% } %>
</div>
<% } %>
Expand Down
19 changes: 13 additions & 6 deletions layout/_template/tools-nav.ejs
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
<%
const btoaStr = (str) => btoa(encodeURIComponent(str)).trim().replaceAll('=', '')
const tools_data = theme.source_data.tools
const tools_data = theme.source_data.tools.map((x, i) => {
if (x.category) {
x.anchorId = btoaStr(x.category) + String(i)
}
return x
})
const tools_nav_data = theme.source_data.tools.filter((t) => t?.category)
%>
<div class="tools-nav-box border-box">
<% if (tools_nav_data.length) { %>
<ul class="tools-nav-list">
<% for (let i = 0; i < tools_nav_data.length; i++) { %>
<% const tool = tools_nav_data[i] %>
<% const anchor_id = btoaStr(tool.category) %>
<% const anchor_id = tool.anchorId %>
<li class="tool-nav-category text-ellipsis border-box <%= anchor_id %> <%= i === 0 ? 'active' : '' %>"
data-anchor="<%= anchor_id %>"
>
Expand All @@ -21,7 +26,7 @@ const tools_nav_data = theme.source_data.tools.filter((t) => t?.category)
<% for (let i = 0; i < tools_data.length; i++) { %>
<% const tool = tools_data[i] %>
<% if (tool?.category) { %>
<% const anchor_id = btoaStr(tool.category) %>
<% const anchor_id = tool.anchorId %>
<li class="tool-category-name text-ellipsis border-box" id="<%= anchor_id %>">
<span class="category-name text-ellipsis"><%= tool.category %></span>
<i class="fa-solid fa-chevron-down fold"></i>
Expand All @@ -32,9 +37,11 @@ const tools_nav_data = theme.source_data.tools.filter((t) => t?.category)
<div class="top border-box">
<div class="logo border-box flex-center <%= tool?.image ? '' : 'has-bg' %>">
<span class="text-color-4"><%= tool?.name.charAt(0).toUpperCase() %></span>
<img src="<%- url_for(tool?.image) %>"
onerror="this.style.display = 'none'"
>
<% if (tool?.image) { %>
<img src="<%- url_for(tool?.image) %>"
onerror="this.style.display = 'none'"
>
<% } %>
</div>
<div class="name flex-start border-box text-ellipsis">
<div class="border-box text-color-3 text-ellipsis">
Expand Down
Loading

0 comments on commit 1a7696b

Please sign in to comment.