hexo-theme-keep/layout/_partial/first-screen.ejs

62 lines
2.7 KiB
Plaintext

<%
const { description: fs_description, hitokoto: fs_hitokoto } = theme.style.first_screen
const { description: c_description } = config
let final_description = fs_description || c_description || ''
final_description = final_description.split('||').map(desc => desc.trim())
if (final_description.length > 2) { final_description.length = 2 }
const { enable: sc_enable, links: sc_links } = theme.social_contact
%>
<div class="first-screen-container flex-center fade-in-down-animation">
<div class="content flex-center">
<% if (final_description.length || fs_hitokoto.enable) { %>
<div class="description hitokoto">
<% for (const idx in final_description) { %>
<div class="desc-item"><%= final_description[idx] %></div>
<% } %>
</div>
<% } %>
<% if (fs_hitokoto.enable) { %>
<script async <%= theme.pjax.enable === true ? 'data-pjax' : '' %>
src="https://v1.hitokoto.cn/?encode=js"
>
</script>
<% } %>
<% if (sc_enable) { %>
<div class="s-icon-list">
<% for (const key in sc_links) { %>
<% if(sc_links[key]) { %>
<%
const tmpl = sc_links[key].split('|').map(x => x.trim())
let isImg = false
let link = sc_links[key]
if (tmpl.length > 1) {
link = tmpl[1]
isImg = tmpl[0] === 'img'
}
%>
<div class="tooltip s-icon-item <%= isImg ? 'tooltip-img clear' : ''%>"
data-content="<%= __(key) %>"
data-name="<%= key %>"
<%= isImg ? 'data-img-url='+ link +'' : '' %>
>
<% if(key === 'email') { %>
<a href="mailto:<%- link %>">
<i class="fas fa-envelope"></i>
</a>
<% } else { %>
<% if(isImg) { %>
<i class="fab fa-<%= key %>"></i>
<% } else { %>
<a target="_blank" href="<%- link %>">
<i class="fab fa-<%= key %>"></i>
</a>
<% } %>
<% } %>
</div>
<% } %>
<% } %>
</div>
<% } %>
</div>
</div>