2025-2-26-fixed
This commit is contained in:
60
themes/next/layout/_layout.swig
Normal file
60
themes/next/layout/_layout.swig
Normal file
@ -0,0 +1,60 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ config.language }}">
|
||||
<head>
|
||||
{{ partial('_partials/head/head.swig', {}, {cache: theme.cache.enable}) }}
|
||||
{% include '_partials/head/head-unique.swig' %}
|
||||
{{- next_inject('head') }}
|
||||
<title>{% block title %}{% endblock %}</title>
|
||||
{{ partial('_third-party/analytics/index.swig', {}, {cache: theme.cache.enable}) }}
|
||||
{{ partial('_scripts/noscript.swig', {}, {cache: theme.cache.enable}) }}
|
||||
</head>
|
||||
|
||||
<body itemscope itemtype="http://schema.org/WebPage">
|
||||
<div class="container{%- if theme.motion.enable %} use-motion{%- endif %}">
|
||||
<div class="headband"></div>
|
||||
|
||||
<header class="header" itemscope itemtype="http://schema.org/WPHeader">
|
||||
<div class="header-inner">{% include '_partials/header/index.swig' %}</div>
|
||||
</header>
|
||||
|
||||
{{ partial('_partials/widgets.swig', {}, {cache: theme.cache.enable}) }}
|
||||
|
||||
<main class="main">
|
||||
<div class="main-inner">
|
||||
<div class="content-wrap">
|
||||
{% include '_partials/header/sub-menu.swig' %}
|
||||
<div class="content {% block class %}{% endblock %}">
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
{% include '_partials/comments.swig' %}
|
||||
</div>
|
||||
{%- if theme.sidebar.display !== 'remove' %}
|
||||
{% block sidebar %}{% endblock %}
|
||||
{%- endif %}
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<footer class="footer">
|
||||
<div class="footer-inner">
|
||||
{% include '_partials/languages.swig' %}
|
||||
{{ partial('_partials/footer.swig', {}, {cache: theme.cache.enable}) }}
|
||||
{{ partial('_third-party/statistics/index.swig', {}, {cache: theme.cache.enable}) }}
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
{{ partial('_scripts/index.swig', {}, {cache: theme.cache.enable}) }}
|
||||
{{ partial('_third-party/index.swig', {}, {cache: theme.cache.enable}) }}
|
||||
|
||||
{%- if theme.pjax %}
|
||||
<div id="pjax">
|
||||
{%- endif %}
|
||||
{% include '_third-party/math/index.swig' %}
|
||||
{% include '_third-party/quicklink.swig' %}
|
||||
|
||||
{{- next_inject('bodyEnd') }}
|
||||
{%- if theme.pjax %}
|
||||
</div>
|
||||
{%- endif %}
|
||||
</body>
|
||||
</html>
|
||||
41
themes/next/layout/_macro/post-collapse.swig
Normal file
41
themes/next/layout/_macro/post-collapse.swig
Normal file
@ -0,0 +1,41 @@
|
||||
{% macro render(posts) %}
|
||||
{%- set current_year = '1970' %}
|
||||
{%- for post in posts.toArray() %}
|
||||
|
||||
{%- set year = date(post.date, 'YYYY') %}
|
||||
|
||||
{%- if year !== current_year %}
|
||||
{%- set current_year = year %}
|
||||
<div class="collection-year">
|
||||
<span class="collection-header">{{ current_year }}</span>
|
||||
</div>
|
||||
{%- endif %}
|
||||
|
||||
<article itemscope itemtype="http://schema.org/Article">
|
||||
<header class="post-header">
|
||||
|
||||
<div class="post-meta">
|
||||
<time itemprop="dateCreated"
|
||||
datetime="{{ moment(post.date).format() }}"
|
||||
content="{{ date(post.date, config.date_format) }}">
|
||||
{{ date(post.date, 'MM-DD') }}
|
||||
</time>
|
||||
</div>
|
||||
|
||||
<div class="post-title">
|
||||
{%- if post.link %}{# Link posts #}
|
||||
{%- set postTitleIcon = '<i class="fa fa-external-link-alt"></i>' %}
|
||||
{%- set postText = post.title or post.link %}
|
||||
{{ next_url(post.link, postText + postTitleIcon, {class: 'post-title-link post-title-link-external', itemprop: 'url'}) }}
|
||||
{% else %}
|
||||
<a class="post-title-link" href="{{ url_for(post.path) }}" itemprop="url">
|
||||
<span itemprop="name">{{ post.title or __('post.untitled') }}</span>
|
||||
</a>
|
||||
{%- endif %}
|
||||
</div>
|
||||
|
||||
</header>
|
||||
</article>
|
||||
|
||||
{%- endfor %}
|
||||
{% endmacro %}
|
||||
259
themes/next/layout/_macro/post.swig
Normal file
259
themes/next/layout/_macro/post.swig
Normal file
@ -0,0 +1,259 @@
|
||||
{##################}
|
||||
{### POST BLOCK ###}
|
||||
{##################}
|
||||
<article itemscope itemtype="http://schema.org/Article" class="post-block" lang="{{ post.lang or config.language }}">
|
||||
<link itemprop="mainEntityOfPage" href="{{ post.permalink }}">
|
||||
|
||||
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
|
||||
<meta itemprop="image" content="{{ url_for(theme.avatar.url or theme.images + '/avatar.gif') }}">
|
||||
<meta itemprop="name" content="{{ author }}">
|
||||
<meta itemprop="description" content="{{ description }}">
|
||||
</span>
|
||||
|
||||
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
|
||||
<meta itemprop="name" content="{{ title }}">
|
||||
</span>
|
||||
|
||||
{%- if post.header !== false %}
|
||||
<header class="post-header">
|
||||
<{%- if is_index %}h2{% else %}h1{%- endif %} class="post-title{%- if post.direction and post.direction.toLowerCase() === 'rtl' %} rtl{%- endif %}" itemprop="name headline">
|
||||
{# Link posts #}
|
||||
{%- if post.link %}
|
||||
{%- if post.sticky > 0 %}
|
||||
<span class="post-sticky-flag" title="{{ __('post.sticky') }}">
|
||||
<i class="fa fa-thumbtack"></i>
|
||||
</span>
|
||||
{%- endif %}
|
||||
{%- set postTitleIcon = '<i class="fa fa-external-link-alt"></i>' %}
|
||||
{%- set postText = post.title or post.link %}
|
||||
{{ next_url(post.link, postText + postTitleIcon, {class: 'post-title-link post-title-link-external', itemprop: 'url'}) }}
|
||||
{% elif is_index %}
|
||||
{%- if post.sticky > 0 %}
|
||||
<span class="post-sticky-flag" title="{{ __('post.sticky') }}">
|
||||
<i class="fa fa-thumbtack"></i>
|
||||
</span>
|
||||
{%- endif %}
|
||||
{{ next_url(post.path, post.title or __('post.untitled'), {class: 'post-title-link', itemprop: 'url'}) }}
|
||||
{%- else %}
|
||||
{{- post.title }}
|
||||
{{- post_edit(post.source) }}
|
||||
{%- endif %}
|
||||
</{%- if is_index %}h2{% else %}h1{%- endif %}>
|
||||
|
||||
<div class="post-meta">
|
||||
|
||||
{%- set date_diff = date(post.date) != date(post.updated) %}
|
||||
{%- set time_diff = time(post.date) != time(post.updated) %}
|
||||
{%- set datetime_diff = date_diff or time_diff %}
|
||||
|
||||
{%- if theme.post_meta.created_at %}
|
||||
<span class="post-meta-item">
|
||||
<span class="post-meta-item-icon">
|
||||
<i class="far fa-calendar"></i>
|
||||
</span>
|
||||
<span class="post-meta-item-text">{{ __('post.posted') }}</span>
|
||||
|
||||
{%- if not date_diff and time_diff and theme.post_meta.updated_at.enable and theme.post_meta.updated_at.another_day %}
|
||||
{%- set create_title = __('post.created') + __('symbol.colon') + full_date(post.date) + ' / ' + __('post.modified') + __('symbol.colon') + time(post.updated) %}
|
||||
{% else %}
|
||||
{%- set create_title = __('post.created') + __('symbol.colon') + full_date(post.date) %}
|
||||
{%- endif %}
|
||||
|
||||
<time title="{{ create_title }}" itemprop="dateCreated datePublished" datetime="{{ moment(post.date).format() }}">{{ date(post.date) }}</time>
|
||||
</span>
|
||||
{%- endif %}
|
||||
|
||||
{%- if theme.post_meta.updated_at.enable and datetime_diff %}
|
||||
{%- set display_updated = not theme.post_meta.updated_at.another_day or theme.post_meta.updated_at.another_day and date_diff %}
|
||||
|
||||
{%- if display_updated or not theme.post_meta.created_at %}
|
||||
<span class="post-meta-item">
|
||||
<span class="post-meta-item-icon">
|
||||
<i class="far fa-calendar-check"></i>
|
||||
</span>
|
||||
<span class="post-meta-item-text">{{ __('post.edited') }}</span>
|
||||
<time title="{{ __('post.modified') + __('symbol.colon') + full_date(post.updated) }}" itemprop="dateModified" datetime="{{ moment(post.updated).format() }}">{{ date(post.updated) }}</time>
|
||||
</span>
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
|
||||
{%- if post.categories and post.categories.length and theme.post_meta.categories %}
|
||||
<span class="post-meta-item">
|
||||
<span class="post-meta-item-icon">
|
||||
<i class="far fa-folder"></i>
|
||||
</span>
|
||||
<span class="post-meta-item-text">{{ __('post.in') }}</span>
|
||||
{%- for cat in post.categories.toArray() %}
|
||||
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
|
||||
<a href="{{ url_for(cat.path) }}" itemprop="url" rel="index"><span itemprop="name">{{ cat.name }}</span></a>
|
||||
</span>
|
||||
|
||||
{%- set cat_length = post.categories.length %}
|
||||
{%- if cat_length > 1 and loop.index !== cat_length %}
|
||||
{{ __('symbol.comma') }}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
</span>
|
||||
{%- endif %}
|
||||
|
||||
{# LeanCloud PageView #}
|
||||
{%- if theme.leancloud_visitors.enable or (theme.valine.enable and theme.valine.appid and theme.valine.appkey and theme.valine.visitor) %}
|
||||
<span id="{{ url_for(post.path) }}" class="post-meta-item leancloud_visitors" data-flag-title="{{ post.title }}" title="{{ __('post.views') }}">
|
||||
<span class="post-meta-item-icon">
|
||||
<i class="fa fa-eye"></i>
|
||||
</span>
|
||||
<span class="post-meta-item-text">{{ __('post.views') + __('symbol.colon') }}</span>
|
||||
<span class="leancloud-visitors-count"></span>
|
||||
</span>
|
||||
{%- endif %}
|
||||
|
||||
{%- if theme.firestore.enable %}
|
||||
<span class="post-meta-item" title="{{ __('post.views') }}">
|
||||
<span class="post-meta-item-icon">
|
||||
<i class="fa fa-users"></i>
|
||||
</span>
|
||||
<span class="post-meta-item-text">{{ __('post.views') + __('symbol.colon') }}</span>
|
||||
<span class="firestore-visitors-count"></span>
|
||||
</span>
|
||||
{%- endif %}
|
||||
|
||||
{%- if not is_index and theme.busuanzi_count.enable and theme.busuanzi_count.post_views %}
|
||||
<span class="post-meta-item" title="{{ __('post.views') }}" id="busuanzi_container_page_pv" style="display: none;">
|
||||
<span class="post-meta-item-icon">
|
||||
<i class="{{ theme.busuanzi_count.post_views_icon }}"></i>
|
||||
</span>
|
||||
<span class="post-meta-item-text">{{ __('post.views') + __('symbol.colon') }}</span>
|
||||
<span id="busuanzi_value_page_pv"></span>
|
||||
</span>
|
||||
{%- endif %}
|
||||
|
||||
{{- next_inject('postMeta') }}
|
||||
|
||||
{%- if config.symbols_count_time.symbols %}
|
||||
{%- if theme.symbols_count_time.separated_meta %}<br>{%- endif %}
|
||||
<span class="post-meta-item" title="{{ __('symbols_count_time.count') }}">
|
||||
<span class="post-meta-item-icon">
|
||||
<i class="far fa-file-word"></i>
|
||||
</span>
|
||||
{%- if theme.symbols_count_time.item_text_post %}
|
||||
<span class="post-meta-item-text">{{ __('symbols_count_time.count') + __('symbol.colon') }}</span>
|
||||
{%- endif %}
|
||||
<span>{{ symbolsCount(post) }}</span>
|
||||
</span>
|
||||
{%- endif %}
|
||||
|
||||
{%- if config.symbols_count_time.time %}
|
||||
<span class="post-meta-item" title="{{ __('symbols_count_time.time') }}">
|
||||
<span class="post-meta-item-icon">
|
||||
<i class="far fa-clock"></i>
|
||||
</span>
|
||||
{%- if theme.symbols_count_time.item_text_post %}
|
||||
<span class="post-meta-item-text">{{ __('symbols_count_time.time') }} ≈</span>
|
||||
{%- endif %}
|
||||
<span>{{ symbolsTime(post, config.symbols_count_time.awl, config.symbols_count_time.wpm, __('symbols_count_time.time_minutes')) }}</span>
|
||||
</span>
|
||||
{%- endif %}
|
||||
|
||||
{%- if post.description and (not theme.excerpt_description or not is_index) %}
|
||||
<div class="post-description">{{ post.description }}</div>
|
||||
{%- endif %}
|
||||
|
||||
</div>
|
||||
</header>
|
||||
{%- endif %}
|
||||
|
||||
{#################}
|
||||
{### POST BODY ###}
|
||||
{#################}
|
||||
<div class="post-body{%- if post.direction and post.direction.toLowerCase() === 'rtl' %} rtl{%- endif %}" itemprop="articleBody">
|
||||
|
||||
{# Gallery support #}
|
||||
{%- if post.photos and post.photos.length %}
|
||||
<div class="post-gallery" itemscope itemtype="http://schema.org/ImageGallery">
|
||||
{%- for photo in post.photos %}
|
||||
<img src="{{ url_for(photo) }}" itemprop="contentUrl">
|
||||
{%- endfor %}
|
||||
</div>
|
||||
{%- endif %}
|
||||
|
||||
{%- if is_index %}
|
||||
{%- if post.description and theme.excerpt_description %}
|
||||
<p>{{ post.description }}</p>
|
||||
<!--noindex-->
|
||||
{%- if theme.read_more_btn %}
|
||||
<div class="post-button">
|
||||
<a class="btn" href="{{ url_for(post.path) }}">
|
||||
{{ __('post.read_more') }} »
|
||||
</a>
|
||||
</div>
|
||||
{%- endif %}
|
||||
<!--/noindex-->
|
||||
{% elif post.excerpt %}
|
||||
{{ post.excerpt }}
|
||||
<!--noindex-->
|
||||
{%- if theme.read_more_btn %}
|
||||
<div class="post-button">
|
||||
<a class="btn" href="{{ url_for(post.path) }}#more" rel="contents">
|
||||
{{ __('post.read_more') }} »
|
||||
</a>
|
||||
</div>
|
||||
{%- endif %}
|
||||
<!--/noindex-->
|
||||
{% else %}
|
||||
{{ post.content }}
|
||||
{%- endif %}
|
||||
{% else %}
|
||||
{{ post.content }}
|
||||
{%- endif %}
|
||||
</div>
|
||||
|
||||
{#####################}
|
||||
{### END POST BODY ###}
|
||||
{#####################}
|
||||
|
||||
{%- if theme.related_posts.enable and (theme.related_posts.display_in_home or not is_index) %}
|
||||
{{ partial('_partials/post/post-related.swig') }}
|
||||
{%- endif %}
|
||||
|
||||
{%- if not is_index %}
|
||||
{{- next_inject('postBodyEnd') }}
|
||||
|
||||
{%- if post.reward_settings.enable %}
|
||||
{{ partial('_partials/post/post-reward.swig') }}
|
||||
{%- endif %}
|
||||
|
||||
{%- if theme.creative_commons.license and theme.creative_commons.post %}
|
||||
{{ partial('_partials/post/post-copyright.swig') }}
|
||||
{%- endif %}
|
||||
|
||||
{%- if theme.follow_me %}
|
||||
{{ partial('_partials/post/post-followme.swig', {}, {cache: theme.cache.enable}) }}
|
||||
{%- endif %}
|
||||
|
||||
<footer class="post-footer">
|
||||
{%- if post.tags and post.tags.length %}
|
||||
{%- if theme.tag_icon %}
|
||||
{%- set tag_indicate = '<i class="fa fa-tag"></i>' %}
|
||||
{% else %}
|
||||
{%- set tag_indicate = '#' %}
|
||||
{%- endif %}
|
||||
<div class="post-tags">
|
||||
{%- for tag in post.tags.toArray() %}
|
||||
<a href="{{ url_for(tag.path) }}" rel="tag">{{ tag_indicate }} {{ tag.name }}</a>
|
||||
{%- endfor %}
|
||||
</div>
|
||||
{%- endif %}
|
||||
|
||||
{{ partial('_partials/post/post-footer.swig', {}, {cache: theme.cache.enable}) }}
|
||||
|
||||
{{ post_nav(post) }}
|
||||
</footer>
|
||||
{% else %}
|
||||
<footer class="post-footer">
|
||||
<div class="post-eof"></div>
|
||||
</footer>
|
||||
{%- endif %}
|
||||
</article>
|
||||
{######################}
|
||||
{### END POST BLOCK ###}
|
||||
{######################}
|
||||
50
themes/next/layout/_macro/sidebar.swig
Normal file
50
themes/next/layout/_macro/sidebar.swig
Normal file
@ -0,0 +1,50 @@
|
||||
{% macro render(display_toc) %}
|
||||
<div class="toggle sidebar-toggle">
|
||||
<span class="toggle-line toggle-line-first"></span>
|
||||
<span class="toggle-line toggle-line-middle"></span>
|
||||
<span class="toggle-line toggle-line-last"></span>
|
||||
</div>
|
||||
|
||||
<aside class="sidebar">
|
||||
<div class="sidebar-inner">
|
||||
|
||||
{%- set display_toc = page.toc.enable and display_toc %}
|
||||
{%- if display_toc %}
|
||||
{%- set toc = toc(page.content, { class: "nav", list_number: page.toc.number, max_depth: page.toc.max_depth }) %}
|
||||
{%- set display_toc = toc.length > 1 and display_toc %}
|
||||
{%- endif %}
|
||||
|
||||
<ul class="sidebar-nav motion-element">
|
||||
<li class="sidebar-nav-toc">
|
||||
{{ __('sidebar.toc') }}
|
||||
</li>
|
||||
<li class="sidebar-nav-overview">
|
||||
{{ __('sidebar.overview') }}
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!--noindex-->
|
||||
<div class="post-toc-wrap sidebar-panel">
|
||||
{%- if display_toc %}
|
||||
<div class="post-toc motion-element">{{ toc }}</div>
|
||||
{%- endif %}
|
||||
</div>
|
||||
<!--/noindex-->
|
||||
|
||||
<div class="site-overview-wrap sidebar-panel">
|
||||
{{ partial('_partials/sidebar/site-overview.swig', {}, {cache: theme.cache.enable}) }}
|
||||
|
||||
{{- next_inject('sidebar') }}
|
||||
</div>
|
||||
|
||||
{%- if theme.back2top.enable and theme.back2top.sidebar %}
|
||||
<div class="back-to-top motion-element">
|
||||
<i class="fa fa-arrow-up"></i>
|
||||
<span>0%</span>
|
||||
</div>
|
||||
{%- endif %}
|
||||
|
||||
</div>
|
||||
</aside>
|
||||
<div id="sidebar-dimmer"></div>
|
||||
{% endmacro %}
|
||||
83
themes/next/layout/_partials/comments.swig
Normal file
83
themes/next/layout/_partials/comments.swig
Normal file
@ -0,0 +1,83 @@
|
||||
{%- if page.comments %}
|
||||
{%- if theme.injects.comment.length == 1 %}
|
||||
{%- set inject_item = theme.injects.comment[0] %}
|
||||
{{ partial(inject_item.layout, inject_item.locals, inject_item.options) }}
|
||||
{%- elif theme.injects.comment.length > 1 %}
|
||||
{%- if theme.comments.style == 'buttons' %}
|
||||
<div class="comment-button-group">
|
||||
{%- for inject_item in theme.injects.comment %}
|
||||
<a class="btn comment-button {{ inject_item.locals.class }}">{{ inject_item.locals.button }}</a>
|
||||
{%- endfor %}
|
||||
</div>
|
||||
{%- for inject_item in theme.injects.comment %}
|
||||
<div class="comment-position {{ inject_item.locals.class }}">
|
||||
{{ partial(inject_item.layout, inject_item.locals, inject_item.options) }}
|
||||
</div>
|
||||
{%- endfor %}
|
||||
<script{{ pjax }}>
|
||||
(function() {
|
||||
let commentButton = document.querySelectorAll('.comment-button');
|
||||
commentButton.forEach(element => {
|
||||
let commentClass = element.classList[2];
|
||||
element.addEventListener('click', () => {
|
||||
commentButton.forEach(rmActive => rmActive.classList.remove('active'));
|
||||
element.classList.add('active');
|
||||
document.querySelectorAll('.comment-position').forEach(rmActive => rmActive.classList.remove('active'));
|
||||
document.querySelector(`.comment-position.${commentClass}`).classList.add('active');
|
||||
if (CONFIG.comments.storage) {
|
||||
localStorage.setItem('comments_active', commentClass);
|
||||
}
|
||||
});
|
||||
});
|
||||
let { activeClass } = CONFIG.comments;
|
||||
if (CONFIG.comments.storage) {
|
||||
activeClass = localStorage.getItem('comments_active') || activeClass;
|
||||
}
|
||||
if (activeClass) {
|
||||
let activeButton = document.querySelector(`.comment-button.${activeClass}`);
|
||||
if (activeButton) {
|
||||
activeButton.click();
|
||||
}
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
{%- elif theme.comments.style == 'tabs' %}
|
||||
<div class="tabs tabs-comment">
|
||||
<ul class="nav-tabs">
|
||||
{%- for inject_item in theme.injects.comment %}
|
||||
<li class="tab"><a href="#comment-{{ inject_item.locals.class }}">{{ inject_item.locals.button }}</a></li>
|
||||
{%- endfor %}
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
{%- for inject_item in theme.injects.comment %}
|
||||
<div class="tab-pane {{ inject_item.locals.class }}" id="comment-{{ inject_item.locals.class }}">
|
||||
{{ partial(inject_item.layout, inject_item.locals, inject_item.options) }}
|
||||
</div>
|
||||
{%- endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
|
||||
<script>
|
||||
window.addEventListener('tabs:register', () => {
|
||||
let { activeClass } = CONFIG.comments;
|
||||
if (CONFIG.comments.storage) {
|
||||
activeClass = localStorage.getItem('comments_active') || activeClass;
|
||||
}
|
||||
if (activeClass) {
|
||||
let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
|
||||
if (activeTab) {
|
||||
activeTab.click();
|
||||
}
|
||||
}
|
||||
});
|
||||
if (CONFIG.comments.storage) {
|
||||
window.addEventListener('tabs:click', event => {
|
||||
if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
|
||||
let commentClass = event.target.classList[1];
|
||||
localStorage.setItem('comments_active', commentClass);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
61
themes/next/layout/_partials/footer.swig
Normal file
61
themes/next/layout/_partials/footer.swig
Normal file
@ -0,0 +1,61 @@
|
||||
{%- if theme.footer.beian.enable %}
|
||||
<div class="beian">
|
||||
{{- next_url('https://beian.miit.gov.cn', theme.footer.beian.icp + ' ') }}
|
||||
{%- if theme.footer.beian.gongan_icon_url %}
|
||||
<img src="{{ url_for(theme.footer.beian.gongan_icon_url) }}" style="display: inline-block;">
|
||||
{%- endif %}
|
||||
{%- if theme.footer.beian.gongan_id and theme.footer.beian.gongan_num %}
|
||||
{{- next_url('http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=' + theme.footer.beian.gongan_id, theme.footer.beian.gongan_num + ' ') }}
|
||||
{%- endif %}
|
||||
</div>
|
||||
{%- endif %}
|
||||
|
||||
<div class="copyright">
|
||||
{% set copyright_year = date(null, 'YYYY') %}
|
||||
© {% if theme.footer.since and theme.footer.since != copyright_year %}{{ theme.footer.since }} – {% endif %}
|
||||
<span itemprop="copyrightYear">{{ copyright_year }}</span>
|
||||
<span class="with-love">
|
||||
<i class="{{ theme.footer.icon.name }}"></i>
|
||||
</span>
|
||||
<span class="author" itemprop="copyrightHolder">{{ theme.footer.copyright or author }}</span>
|
||||
|
||||
{%- if config.symbols_count_time.total_symbols %}
|
||||
<span class="post-meta-divider">|</span>
|
||||
<span class="post-meta-item-icon">
|
||||
<i class="fa fa-chart-area"></i>
|
||||
</span>
|
||||
{%- if theme.symbols_count_time.item_text_total %}
|
||||
<span class="post-meta-item-text">{{ __('symbols_count_time.count_total') + __('symbol.colon') }}</span>
|
||||
{%- endif %}
|
||||
<span title="{{ __('symbols_count_time.count_total') }}">{{ symbolsCountTotal(site) }}</span>
|
||||
{%- endif %}
|
||||
|
||||
{%- if config.symbols_count_time.total_time %}
|
||||
<span class="post-meta-divider">|</span>
|
||||
<span class="post-meta-item-icon">
|
||||
<i class="fa fa-coffee"></i>
|
||||
</span>
|
||||
{%- if theme.symbols_count_time.item_text_total %}
|
||||
<span class="post-meta-item-text">{{ __('symbols_count_time.time_total') }} ≈</span>
|
||||
{%- endif %}
|
||||
<span title="{{ __('symbols_count_time.time_total') }}">{{ symbolsTimeTotal(site, config.symbols_count_time.awl, config.symbols_count_time.wpm, __('symbols_count_time.time_minutes')) }}</span>
|
||||
{%- endif %}
|
||||
</div>
|
||||
|
||||
{%- if theme.footer.powered %}
|
||||
<div class="powered-by">
|
||||
{%- set next_site = 'https://theme-next.org' %}
|
||||
{%- if theme.scheme !== 'Gemini' %}
|
||||
{%- set next_site = 'https://' + theme.scheme | lower + '.theme-next.org' %}
|
||||
{%- endif %}
|
||||
{{- __('footer.powered', next_url('https://hexo.io', 'Hexo', {class: 'theme-link'}) + ' & ' + next_url(next_site, 'NexT.' + theme.scheme, {class: 'theme-link'})) }}
|
||||
</div>
|
||||
{%- endif %}
|
||||
|
||||
{%- if theme.add_this_id %}
|
||||
<div class="addthis_inline_share_toolbox">
|
||||
<script src="//s7.addthis.com/js/300/addthis_widget.js#pubid={{ theme.add_this_id }}" async="async"></script>
|
||||
</div>
|
||||
{%- endif %}
|
||||
|
||||
{{- next_inject('footer') }}
|
||||
14
themes/next/layout/_partials/head/head-unique.swig
Normal file
14
themes/next/layout/_partials/head/head-unique.swig
Normal file
@ -0,0 +1,14 @@
|
||||
{{ open_graph() }}
|
||||
|
||||
{{ canonical() }}
|
||||
|
||||
{# Exports some front-matter variables to Front-End #}
|
||||
<script id="page-configurations">
|
||||
// https://hexo.io/docs/variables.html
|
||||
CONFIG.page = {
|
||||
sidebar: {{ page.sidebar | json }},
|
||||
isHome : {{ is_home() }},
|
||||
isPost : {{ is_post() }},
|
||||
lang : '{{ page.lang }}'
|
||||
};
|
||||
</script>
|
||||
61
themes/next/layout/_partials/head/head.swig
Normal file
61
themes/next/layout/_partials/head/head.swig
Normal file
@ -0,0 +1,61 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
|
||||
<meta name="theme-color" content="{{ theme.android_chrome_color }}">
|
||||
<meta name="generator" content="Hexo {{ hexo_version }}">
|
||||
|
||||
{%- if theme.favicon.apple_touch_icon %}
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="{{ url_for(theme.favicon.apple_touch_icon) }}">
|
||||
{%- endif %}
|
||||
{%- if theme.favicon.medium %}
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="{{ url_for(theme.favicon.medium) }}">
|
||||
{%- endif %}
|
||||
{%- if theme.favicon.small %}
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="{{ url_for(theme.favicon.small) }}">
|
||||
{%- endif %}
|
||||
{%- if theme.favicon.safari_pinned_tab %}
|
||||
<link rel="mask-icon" href="{{ url_for(theme.favicon.safari_pinned_tab) }}" color="{{ theme.android_chrome_color }}">
|
||||
{%- endif %}
|
||||
{%- if theme.favicon.android_manifest %}
|
||||
<link rel="manifest" href="{{ url_for(theme.favicon.android_manifest) }}">
|
||||
{%- endif %}
|
||||
{%- if theme.favicon.ms_browserconfig %}
|
||||
<meta name="msapplication-config" content="{{ url_for(theme.favicon.ms_browserconfig) }}">
|
||||
{%- endif %}
|
||||
|
||||
{%- if theme.disable_baidu_transformation %}
|
||||
<meta http-equiv="Cache-Control" content="no-transform">
|
||||
<meta http-equiv="Cache-Control" content="no-siteapp">
|
||||
{%- endif %}
|
||||
{%- if theme.google_site_verification %}
|
||||
<meta name="google-site-verification" content="{{ theme.google_site_verification }}">
|
||||
{%- endif %}
|
||||
{%- if theme.bing_site_verification %}
|
||||
<meta name="msvalidate.01" content="{{ theme.bing_site_verification }}">
|
||||
{%- endif %}
|
||||
{%- if theme.yandex_site_verification %}
|
||||
<meta name="yandex-verification" content="{{ theme.yandex_site_verification }}">
|
||||
{%- endif %}
|
||||
{%- if theme.baidu_site_verification %}
|
||||
<meta name="baidu-site-verification" content="{{ theme.baidu_site_verification }}">
|
||||
{%- endif %}
|
||||
|
||||
<link rel="stylesheet" href="{{ url_for(theme.css) }}/main.css">
|
||||
|
||||
{{ next_font() }}
|
||||
|
||||
{%- set font_awesome_uri = theme.vendors.fontawesome or next_vendors('font-awesome/css/all.min.css') %}
|
||||
<link rel="stylesheet" href="{{ font_awesome_uri }}">
|
||||
|
||||
{%- if theme.fancybox %}
|
||||
{%- set fancybox_css_uri = theme.vendors.fancybox_css or next_vendors('//cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.css') %}
|
||||
<link rel="stylesheet" href="{{ fancybox_css_uri }}">
|
||||
{%- endif %}
|
||||
|
||||
{%- if theme.pace.enable %}
|
||||
{%- set pace_css_uri = theme.vendors.pace_css or next_vendors('pace/pace-theme-' + theme.pace.theme + '.min.css') %}
|
||||
{%- set pace_js_uri = theme.vendors.pace or next_vendors('pace/pace.min.js') %}
|
||||
<link rel="stylesheet" href="{{ pace_css_uri }}">
|
||||
<script src="{{ pace_js_uri }}"></script>
|
||||
{%- endif %}
|
||||
|
||||
{{ next_config() }}
|
||||
41
themes/next/layout/_partials/header/brand.swig
Normal file
41
themes/next/layout/_partials/header/brand.swig
Normal file
@ -0,0 +1,41 @@
|
||||
<div class="site-brand-container">
|
||||
<div class="site-nav-toggle">
|
||||
<div class="toggle" aria-label="{{ __('accessibility.nav_toggle') }}">
|
||||
<span class="toggle-line toggle-line-first"></span>
|
||||
<span class="toggle-line toggle-line-middle"></span>
|
||||
<span class="toggle-line toggle-line-last"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="site-meta{%- if theme.custom_logo %} custom-logo{%- endif %}">
|
||||
{%- if theme.custom_logo and theme.scheme === 'Muse' %}
|
||||
<div class="site-meta-headline">
|
||||
<a>
|
||||
<img class="custom-logo-image" src="{{ theme.custom_logo }}" alt="{{ title }}">
|
||||
</a>
|
||||
</div>
|
||||
{%- endif %}
|
||||
|
||||
<a href="{{ config.root }}" class="brand" rel="start">
|
||||
<span class="logo-line-before"><i></i></span>
|
||||
<h1 class="site-title">{{ title }}</h1>
|
||||
<span class="logo-line-after"><i></i></span>
|
||||
</a>
|
||||
{%- if subtitle %}
|
||||
<p class="site-subtitle" itemprop="description">{{ subtitle }}</p>
|
||||
{%- endif %}
|
||||
{%- if theme.custom_logo and (theme.scheme === 'Gemini' or theme.scheme === 'Pisces') %}
|
||||
<a>
|
||||
<img class="custom-logo-image" src="{{ theme.custom_logo }}" alt="{{ title }}">
|
||||
</a>
|
||||
{%- endif %}
|
||||
</div>
|
||||
|
||||
<div class="site-nav-right">
|
||||
<div class="toggle popup-trigger">
|
||||
{%- if theme.algolia_search.enable or theme.local_search.enable %}
|
||||
<i class="fa fa-search fa-fw fa-lg"></i>
|
||||
{%- endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
7
themes/next/layout/_partials/header/index.swig
Normal file
7
themes/next/layout/_partials/header/index.swig
Normal file
@ -0,0 +1,7 @@
|
||||
{{ partial('_partials/header/brand.swig', {}, {cache: theme.cache.enable}) }}
|
||||
|
||||
{{ partial('_partials/header/menu.swig', {}, {cache: theme.cache.enable}) }}
|
||||
|
||||
{{ partial('_partials/search/index.swig', {}, {cache: theme.cache.enable}) }}
|
||||
|
||||
{{- next_inject('header') }}
|
||||
34
themes/next/layout/_partials/header/menu-item.swig
Normal file
34
themes/next/layout/_partials/header/menu-item.swig
Normal file
@ -0,0 +1,34 @@
|
||||
{% macro render(name, itemName, value) %}
|
||||
|
||||
{%- set itemURL = value.split('||')[0] | trim %}
|
||||
{%- if not itemURL.startsWith('http') %}
|
||||
{%- set itemURL = itemURL | replace('//', '/') %}
|
||||
{%- endif %}
|
||||
<li class="menu-item menu-item-{{ itemName | replace(' ', '-') }}">
|
||||
|
||||
{%- set menuIcon = '' %}
|
||||
{%- if theme.menu_settings.icons %}
|
||||
{%- set menuIcon = '<i class="' + value.split('||')[1] | trim + ' fa-fw"></i>' %}
|
||||
{%- endif %}
|
||||
{%- set menuText = __('menu.' + name) | replace('menu.', '') %}
|
||||
|
||||
{%- set menuBadge = '' %}
|
||||
{%- if theme.menu_settings.badges %}
|
||||
{%- set badges = {
|
||||
archives : site.posts.length,
|
||||
categories: site.categories.length,
|
||||
tags : site.tags.length
|
||||
}
|
||||
%}
|
||||
{%- for menu, count in badges %}
|
||||
{%- if name == menu %}
|
||||
{%- set menuBadge = '<span class="badge">' + count + '</span>' %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
|
||||
{{ next_url(itemURL, menuIcon + menuText + menuBadge, {rel: 'section'}) }}
|
||||
|
||||
</li>
|
||||
|
||||
{% endmacro %}
|
||||
34
themes/next/layout/_partials/header/menu.swig
Normal file
34
themes/next/layout/_partials/header/menu.swig
Normal file
@ -0,0 +1,34 @@
|
||||
{% import 'menu-item.swig' as menu_item with context %}
|
||||
|
||||
<nav class="site-nav">
|
||||
{%- if theme.menu %}
|
||||
<ul id="menu" class="main-menu menu">
|
||||
{%- for name, path in theme.menu %}
|
||||
{%- set respath = path %}
|
||||
{%- if path == '[object Object]' %}
|
||||
{# Main Menu (default menu item for Submenu) #}
|
||||
{%- for subname, subpath in path %}
|
||||
{%- set itemName = subname | lower %}
|
||||
{%- set respath = subpath %}
|
||||
{%- if itemName == 'default' %}
|
||||
{%- set itemName = name | lower %}
|
||||
{{ menu_item.render(name, itemName, respath) }}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{% else %}
|
||||
{# Main Menu (standard menu items) #}
|
||||
{%- set itemName = name | lower %}
|
||||
{{- menu_item.render(name, itemName, respath) | trim }}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
|
||||
{%- if theme.algolia_search.enable or theme.local_search.enable %}
|
||||
<li class="menu-item menu-item-search">
|
||||
<a role="button" class="popup-trigger">
|
||||
{%- if theme.menu_settings.icons %}<i class="fa fa-search fa-fw"></i>{%- endif %}{{ __('menu.search') }}
|
||||
</a>
|
||||
</li>
|
||||
{%- endif %}
|
||||
</ul>
|
||||
{%- endif %}
|
||||
</nav>
|
||||
96
themes/next/layout/_partials/header/sub-menu.swig
Normal file
96
themes/next/layout/_partials/header/sub-menu.swig
Normal file
@ -0,0 +1,96 @@
|
||||
{% import '_partials/header/menu-item.swig' as menu_item with context %}
|
||||
|
||||
{%- if theme.menu and is_page() %}
|
||||
{# Submenu & Submenu-2 #}
|
||||
{%- for name, value in theme.menu %}
|
||||
{%- set respath = value %}
|
||||
{%- if value == '[object Object]' %}
|
||||
|
||||
{# If current URL is value of parent submenu 'default' path #}
|
||||
{%- set currentParentUrl = page.path.split('/')[0] | trim %}
|
||||
{%- if currentParentUrl == value.default.split('||')[0] | trim | replace('/', '') %}
|
||||
|
||||
{# Submenu items #}
|
||||
<ul id="sub-menu" class="sub-menu menu">
|
||||
{%- for subname, subvalue in value %}
|
||||
{# For main submenu items #}
|
||||
{%- if subvalue != '[object Object]' %}
|
||||
{%- set itemName = subname | lower %}
|
||||
{%- if itemName == 'default' %}
|
||||
{%- set parentValue = subvalue.split('||')[0] | trim %}
|
||||
{% else %}
|
||||
{%- if subvalue.startsWith('http') %}
|
||||
{%- set respath = subvalue %}
|
||||
{% else %}
|
||||
{%- set respath = parentValue + subvalue %}
|
||||
{%- endif %}
|
||||
{{ menu_item.render(subname, itemName, respath) }}
|
||||
{%- endif %}
|
||||
{% else %}
|
||||
{# For 'default' submenu item in main submenu #}
|
||||
{%- set itemName = subname | lower %}
|
||||
{%- for subname2, subvalue2 in subvalue %}
|
||||
{%- if subname2 == 'default' %}
|
||||
{%- set respath = parentValue + subvalue2 %}
|
||||
{{ menu_item.render(subname, itemName, respath) }}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
</ul>
|
||||
{# End Submenu items #}
|
||||
|
||||
{# Submenu-2 #}
|
||||
{%- for name, value in theme.menu %}
|
||||
{%- set respath = value %}
|
||||
{%- if value == '[object Object]' %}
|
||||
|
||||
{%- for subname, subvalue in value %}
|
||||
{%- set itemName = subname | lower %}
|
||||
{%- if itemName == 'default' %}
|
||||
{%- set parentValue = subvalue.split('||')[0] | trim %}
|
||||
{%- endif %}
|
||||
{%- if subvalue == '[object Object]' %}
|
||||
|
||||
{# If current URL is value of parent submenu 'default' path #}
|
||||
{%- set paths = page.path.split('/') %}
|
||||
{%- if paths.length > 2 %}
|
||||
{%- if paths[1] == subvalue.default.split('||')[0] | trim | replace('/', '') %}
|
||||
|
||||
{# Submenu-2 items #}
|
||||
<ul id="sub-menu-2" class="sub-menu menu">
|
||||
{%- for subname2, subvalue2 in subvalue %}
|
||||
{%- set respath2 = subvalue %}
|
||||
{%- set itemName = subname2 | lower %}
|
||||
{%- if itemName == 'default' %}
|
||||
{%- set parentSubValue = subvalue2.split('||')[0] | trim %}
|
||||
{% else %}
|
||||
{%- if subvalue2.startsWith('http') %}
|
||||
{%- set respath2 = subvalue2 %}
|
||||
{% else %}
|
||||
{%- set respath2 = parentValue + parentSubValue + subvalue2 %}
|
||||
{%- endif %}
|
||||
{{ menu_item.render(subname2, itemName, respath2) }}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
</ul>
|
||||
{# End Submenu-2 items #}
|
||||
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{# End URL & path comparing #}
|
||||
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{# End Submenu-2 #}
|
||||
|
||||
{%- endif %}
|
||||
{# End URL & path comparing #}
|
||||
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{# End Submenu & Submenu-2 #}
|
||||
{%- endif %}
|
||||
16
themes/next/layout/_partials/languages.swig
Normal file
16
themes/next/layout/_partials/languages.swig
Normal file
@ -0,0 +1,16 @@
|
||||
{%- if theme.language_switcher and languages.length > 1 %}
|
||||
<div class="languages">
|
||||
<label class="lang-select-label">
|
||||
<i class="fa fa-language"></i>
|
||||
<span>{{ language_name(page.lang) }}</span>
|
||||
<i class="fa fa-angle-up" aria-hidden="true"></i>
|
||||
</label>
|
||||
<select class="lang-select" data-canonical="">
|
||||
{% for language in languages %}
|
||||
<option value="{{ language }}" data-href="{{ i18n_path(language) }}" selected="">
|
||||
{{ language_name(language) }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
{%- endif %}
|
||||
27
themes/next/layout/_partials/page/breadcrumb.swig
Normal file
27
themes/next/layout/_partials/page/breadcrumb.swig
Normal file
@ -0,0 +1,27 @@
|
||||
{%- set paths = page.path.split('/') %}
|
||||
{%- set count = paths.length %}
|
||||
{%- if count > 2 %}
|
||||
{%- set current = 0 %}
|
||||
{%- set link = '' %}
|
||||
<ul class="breadcrumb">
|
||||
{%- for path in paths %}
|
||||
{%- set current = current + 1 %}
|
||||
{%- if path != 'index.html' %}
|
||||
{%- if current == count - 1 and paths[count - 1] == 'index.html' %}
|
||||
<li>{{ path | upper }}</li>
|
||||
{% else %}
|
||||
{%- if link == '' %}
|
||||
{%- set link = '/' + path %}
|
||||
{% else %}
|
||||
{%- set link = link + '/' + path %}
|
||||
{%- endif %}
|
||||
{%- if path.includes('.html') %}
|
||||
<li>{{ path | replace('.html', '') | upper }}</li>
|
||||
{% else %}
|
||||
<li><a href="{{ url_for(link) }}/">{{ path | upper }}</a></li>
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
</ul>
|
||||
{%- endif %}
|
||||
15
themes/next/layout/_partials/page/page-header.swig
Normal file
15
themes/next/layout/_partials/page/page-header.swig
Normal file
@ -0,0 +1,15 @@
|
||||
<header class="post-header">
|
||||
|
||||
<h1 class="post-title" itemprop="name headline">
|
||||
{{- page.title }}
|
||||
{{- post_edit(page.source) }}
|
||||
</h1>
|
||||
|
||||
<div class="post-meta">
|
||||
{%- if page.description %}
|
||||
<div class="post-description">{{ page.description }}</div>
|
||||
{%- endif %}
|
||||
{% include '_partials/page/breadcrumb.swig' %}
|
||||
</div>
|
||||
|
||||
</header>
|
||||
12
themes/next/layout/_partials/pagination.swig
Normal file
12
themes/next/layout/_partials/pagination.swig
Normal file
@ -0,0 +1,12 @@
|
||||
{%- if page.prev or page.next %}
|
||||
<nav class="pagination">
|
||||
{{
|
||||
paginator({
|
||||
prev_text: '<i class="fa fa-angle-left" aria-label="' + __('accessibility.prev_page') + '"></i>',
|
||||
next_text: '<i class="fa fa-angle-right" aria-label="' + __('accessibility.next_page') + '"></i>',
|
||||
mid_size : 1,
|
||||
escape : false
|
||||
})
|
||||
}}
|
||||
</nav>
|
||||
{%- endif %}
|
||||
19
themes/next/layout/_partials/post/post-copyright.swig
Normal file
19
themes/next/layout/_partials/post/post-copyright.swig
Normal file
@ -0,0 +1,19 @@
|
||||
{%- set ccIcon = '<i class="fab fa-fw fa-creative-commons"></i>' %}
|
||||
{%- set ccText = theme.creative_commons.license | upper %}
|
||||
|
||||
<div>
|
||||
<ul class="post-copyright">
|
||||
<li class="post-copyright-author">
|
||||
<strong>{{ __('post.copyright.author') + __('symbol.colon') }} </strong>
|
||||
{{- page.author or author }}
|
||||
</li>
|
||||
<li class="post-copyright-link">
|
||||
<strong>{{ __('post.copyright.link') + __('symbol.colon') }}</strong>
|
||||
{{ next_url(page.permalink, page.permalink, {title: page.title}) }}
|
||||
</li>
|
||||
<li class="post-copyright-license">
|
||||
<strong>{{ __('post.copyright.license_title') + __('symbol.colon') }} </strong>
|
||||
{{- __('post.copyright.license_content', next_url(ccURL, ccIcon + ccText)) }}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
23
themes/next/layout/_partials/post/post-followme.swig
Normal file
23
themes/next/layout/_partials/post/post-followme.swig
Normal file
@ -0,0 +1,23 @@
|
||||
{%- if theme.follow_me %}
|
||||
|
||||
<div class="followme">
|
||||
<p>{{ __('follow_me.welcome') }}</p>
|
||||
|
||||
<div class="social-list">
|
||||
{%- for name, value in theme.follow_me %}
|
||||
{%- set link = value.split('||')[0] | trim %}
|
||||
{%- set icon = value.split('||')[1] | trim %}
|
||||
|
||||
<div class="social-item">
|
||||
<a target="_blank" class="social-link" href="{{ link }}">
|
||||
<span class="icon">
|
||||
<i class="{{ icon }}"></i>
|
||||
</span>
|
||||
|
||||
<span class="label">{{ name }}</span>
|
||||
</a>
|
||||
</div>
|
||||
{%- endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{%- endif %}
|
||||
7
themes/next/layout/_partials/post/post-footer.swig
Normal file
7
themes/next/layout/_partials/post/post-footer.swig
Normal file
@ -0,0 +1,7 @@
|
||||
{%- if theme.rating.enable %}
|
||||
<div class="post-widgets">
|
||||
<div class="wp_rating">
|
||||
<div id="wpac-rating"></div>
|
||||
</div>
|
||||
</div>
|
||||
{%- endif %}
|
||||
20
themes/next/layout/_partials/post/post-related.swig
Normal file
20
themes/next/layout/_partials/post/post-related.swig
Normal file
@ -0,0 +1,20 @@
|
||||
{%- set popular_posts = popular_posts_json(theme.related_posts.params, page) %}
|
||||
{%- if popular_posts.json and popular_posts.json.length > 0 %}
|
||||
<div class="popular-posts-header">{{ theme.related_posts.title or __('post.related_posts') }}</div>
|
||||
<ul class="popular-posts">
|
||||
{%- for popular_post in popular_posts.json %}
|
||||
<li class="popular-posts-item">
|
||||
{%- if popular_post.date and popular_post.date != '' %}
|
||||
<div class="popular-posts-date">{{ popular_post.date }}</div>
|
||||
{%- endif %}
|
||||
{%- if popular_post.img and popular_post.img != '' %}
|
||||
<div class="popular-posts-img"><img src="{{ popular_post.img }}"></div>
|
||||
{%- endif %}
|
||||
<div class="popular-posts-title"><a href="{{ popular_post.path }}" rel="bookmark">{{ popular_post.title }}</a></div>
|
||||
{%- if popular_post.excerpt and popular_post.excerpt != '' %}
|
||||
<div class="popular-posts-excerpt"><p>{{ popular_post.excerpt }}</p></div>
|
||||
{%- endif %}
|
||||
</li>
|
||||
{%- endfor %}
|
||||
</ul>
|
||||
{%- endif %}
|
||||
22
themes/next/layout/_partials/post/post-reward.swig
Normal file
22
themes/next/layout/_partials/post/post-reward.swig
Normal file
@ -0,0 +1,22 @@
|
||||
<div class="reward-container">
|
||||
<div>{{ page.reward_settings.comment }}</div>
|
||||
<button onclick="var qr = document.getElementById('qr'); qr.style.display = (qr.style.display === 'none') ? 'block' : 'none';">
|
||||
{{ __('reward.donate') }}
|
||||
</button>
|
||||
<div id="qr" style="display: none;">
|
||||
|
||||
{%- for name, image in theme.reward %}
|
||||
{%- set builtin = ['wechatpay', 'alipay', 'paypal', 'bitcoin'] %}
|
||||
{%- if builtin.includes(name) %}
|
||||
{%- set translation = __('reward.' + name) %}
|
||||
{% else %}
|
||||
{%- set translation = name %}
|
||||
{%- endif %}
|
||||
<div style="display: inline-block;">
|
||||
<img src="{{ url_for(image) }}" alt="{{ author }} {{ translation }}">
|
||||
<p>{{ translation }}</p>
|
||||
</div>
|
||||
{%- endfor %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
14
themes/next/layout/_partials/search/algolia-search.swig
Normal file
14
themes/next/layout/_partials/search/algolia-search.swig
Normal file
@ -0,0 +1,14 @@
|
||||
<div class="search-header">
|
||||
<span class="search-icon">
|
||||
<i class="fa fa-search"></i>
|
||||
</span>
|
||||
<div class="search-input-container"></div>
|
||||
<span class="popup-btn-close">
|
||||
<i class="fa fa-times-circle"></i>
|
||||
</span>
|
||||
</div>
|
||||
<div class="algolia-results">
|
||||
<div id="algolia-stats"></div>
|
||||
<div id="algolia-hits"></div>
|
||||
<div id="algolia-pagination" class="algolia-pagination"></div>
|
||||
</div>
|
||||
11
themes/next/layout/_partials/search/index.swig
Normal file
11
themes/next/layout/_partials/search/index.swig
Normal file
@ -0,0 +1,11 @@
|
||||
{%- if theme.algolia_search.enable or theme.local_search.enable %}
|
||||
<div class="search-pop-overlay">
|
||||
<div class="popup search-popup">
|
||||
{%- if theme.algolia_search.enable %}
|
||||
{% include 'algolia-search.swig' %}
|
||||
{% elif theme.local_search.enable %}
|
||||
{% include 'localsearch.swig' %}
|
||||
{%- endif %}
|
||||
</div>
|
||||
</div>
|
||||
{%- endif %}
|
||||
18
themes/next/layout/_partials/search/localsearch.swig
Normal file
18
themes/next/layout/_partials/search/localsearch.swig
Normal file
@ -0,0 +1,18 @@
|
||||
<div class="search-header">
|
||||
<span class="search-icon">
|
||||
<i class="fa fa-search"></i>
|
||||
</span>
|
||||
<div class="search-input-container">
|
||||
<input autocomplete="off" autocapitalize="off"
|
||||
placeholder="{{ __('search.placeholder') }}" spellcheck="false"
|
||||
type="search" class="search-input">
|
||||
</div>
|
||||
<span class="popup-btn-close">
|
||||
<i class="fa fa-times-circle"></i>
|
||||
</span>
|
||||
</div>
|
||||
<div id="search-result">
|
||||
<div id="no-result">
|
||||
<i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
|
||||
</div>
|
||||
</div>
|
||||
120
themes/next/layout/_partials/sidebar/site-overview.swig
Normal file
120
themes/next/layout/_partials/sidebar/site-overview.swig
Normal file
@ -0,0 +1,120 @@
|
||||
<div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
|
||||
{%- if theme.avatar.url %}
|
||||
<img class="site-author-image" itemprop="image" alt="{{ author }}"
|
||||
src="{{ url_for(theme.avatar.url) }}">
|
||||
{%- endif %}
|
||||
<p class="site-author-name" itemprop="name">{{ author }}</p>
|
||||
<div class="site-description" itemprop="description">{{ description }}</div>
|
||||
</div>
|
||||
|
||||
{%- if theme.site_state %}
|
||||
<div class="site-state-wrap motion-element">
|
||||
<nav class="site-state">
|
||||
{%- if config.archive_dir != '/' and site.posts.length > 0 %}
|
||||
<div class="site-state-item site-state-posts">
|
||||
{%- if theme.menu.archives %}
|
||||
<a href="{{ url_for(theme.menu.archives.split('||')[0] | trim) }}">
|
||||
{% else %}
|
||||
<a href="{{ url_for(config.archive_dir) }}">
|
||||
{%- endif %}
|
||||
<span class="site-state-item-count">{{ site.posts.length }}</span>
|
||||
<span class="site-state-item-name">{{ __('state.posts') }}</span>
|
||||
</a>
|
||||
</div>
|
||||
{%- endif %}
|
||||
|
||||
{%- if site.categories.length > 0 %}
|
||||
{%- set categoriesPageQuery = site.pages.find({type: 'categories'}, {lean: true}) %}
|
||||
{%- set hasCategoriesPage = categoriesPageQuery.length > 0 %}
|
||||
<div class="site-state-item site-state-categories">
|
||||
{%- if hasCategoriesPage %}
|
||||
{%- if theme.menu.categories %}
|
||||
<a href="{{ url_for(theme.menu.categories.split('||')[0] | trim) }}">
|
||||
{% else %}
|
||||
<a href="{{ url_for(config.category_dir) + '/' }}">
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
<span class="site-state-item-count">{{ site.categories.length }}</span>
|
||||
<span class="site-state-item-name">{{ __('state.categories') }}</span>
|
||||
{%- if hasCategoriesPage %}</a>{%- endif %}
|
||||
</div>
|
||||
{%- endif %}
|
||||
|
||||
{%- if site.tags.length > 0 %}
|
||||
{%- set tagsPageQuery = site.pages.find({type: 'tags'}, {lean: true}) %}
|
||||
{%- set hasTagsPage = tagsPageQuery.length > 0 %}
|
||||
<div class="site-state-item site-state-tags">
|
||||
{%- if hasTagsPage %}
|
||||
{%- if theme.menu.tags %}
|
||||
<a href="{{ url_for(theme.menu.tags.split('||')[0] | trim) }}">
|
||||
{% else %}
|
||||
<a href="{{ url_for(config.tag_dir) + '/' }}">
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
<span class="site-state-item-count">{{ site.tags.length }}</span>
|
||||
<span class="site-state-item-name">{{ __('state.tags') }}</span>
|
||||
{%- if hasTagsPage %}</a>{%- endif %}
|
||||
</div>
|
||||
{%- endif %}
|
||||
</nav>
|
||||
</div>
|
||||
{%- endif %}
|
||||
|
||||
{%- if theme.chat.enable and theme.chat.service !== '' %}
|
||||
<div class="sidebar-button motion-element">
|
||||
{%- if theme.chat.service == 'chatra' and theme.chatra.enable %}
|
||||
<a onclick="Chatra('openChat', true);">
|
||||
{%- endif %}
|
||||
{%- if theme.chat.service == 'tidio' and theme.tidio.enable %}
|
||||
<a onclick="tidioChatApi.open();">
|
||||
{%- endif %}
|
||||
{%- if theme.chat.icon %}<i class="{{ theme.chat.icon }}"></i>{%- endif %}
|
||||
{{ theme.chat.text }}
|
||||
</a>
|
||||
</div>
|
||||
{%- endif %}
|
||||
|
||||
{%- if theme.social %}
|
||||
<div class="links-of-author motion-element">
|
||||
{%- for name, link in theme.social %}
|
||||
<span class="links-of-author-item">
|
||||
{%- set sidebarURL = link.split('||')[0] | trim %}
|
||||
{%- if theme.social_icons.enable %}
|
||||
{%- set sidebarIcon = '<i class="' + link.split('||')[1] | trim + ' fa-fw"></i>' %}
|
||||
{%- else %}
|
||||
{%- set sidebarIcon = '' %}
|
||||
{%- endif %}
|
||||
{%- if theme.social_icons.enable and theme.social_icons.icons_only %}
|
||||
{%- set sidebarText = '' %}
|
||||
{%- else %}
|
||||
{%- set sidebarText = name %}
|
||||
{%- endif %}
|
||||
{{ next_url(sidebarURL, sidebarIcon + sidebarText, {title: name + ' → ' + sidebarURL}) }}
|
||||
</span>
|
||||
{%- endfor %}
|
||||
</div>
|
||||
{%- endif %}
|
||||
|
||||
{%- if theme.creative_commons.license and theme.creative_commons.sidebar %}
|
||||
<div class="cc-license motion-element" itemprop="license">
|
||||
{%- set ccImage = '<img src="' + url_for(theme.images + '/cc-' + theme.creative_commons.license + '.svg') + '" alt="Creative Commons">' %}
|
||||
{{ next_url(ccURL, ccImage, {class: 'cc-opacity'}) }}
|
||||
</div>
|
||||
{%- endif %}
|
||||
|
||||
{# Blogroll #}
|
||||
{%- if theme.links %}
|
||||
<div class="links-of-blogroll motion-element">
|
||||
<div class="links-of-blogroll-title">
|
||||
{%- if theme.links_settings.icon %}<i class="{{ theme.links_settings.icon }} fa-fw"></i>{%- endif %}
|
||||
{{ theme.links_settings.title }}
|
||||
</div>
|
||||
<ul class="links-of-blogroll-list">
|
||||
{%- for blogrollText, blogrollURL in theme.links %}
|
||||
<li class="links-of-blogroll-item">
|
||||
{{ next_url(blogrollURL, blogrollText, {title: blogrollURL}) }}
|
||||
</li>
|
||||
{%- endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{%- endif %}
|
||||
20
themes/next/layout/_partials/widgets.swig
Normal file
20
themes/next/layout/_partials/widgets.swig
Normal file
@ -0,0 +1,20 @@
|
||||
{%- if theme.back2top.enable and not theme.back2top.sidebar %}
|
||||
<div class="back-to-top">
|
||||
<i class="fa fa-arrow-up"></i>
|
||||
<span>0%</span>
|
||||
</div>
|
||||
{%- endif %}
|
||||
{%- if theme.reading_progress.enable %}
|
||||
<div class="reading-progress-bar"></div>
|
||||
{%- endif %}
|
||||
{%- if theme.bookmark.enable %}
|
||||
<a role="button" class="book-mark-link book-mark-link-fixed"></a>
|
||||
{%- endif %}
|
||||
{%- if theme.github_banner.enable %}
|
||||
{%- set github_URL = theme.github_banner.permalink %}
|
||||
{%- set github_title = theme.github_banner.title %}
|
||||
|
||||
{%- set github_image = '<svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg>' %}
|
||||
|
||||
{{ next_url(github_URL, github_image, {class: 'github-corner', title: github_title, "aria-label": github_title}) }}
|
||||
{%- endif %}
|
||||
18
themes/next/layout/_scripts/index.swig
Normal file
18
themes/next/layout/_scripts/index.swig
Normal file
@ -0,0 +1,18 @@
|
||||
{% include 'vendors.swig' %}
|
||||
|
||||
{{- next_js('utils.js') }}
|
||||
{%- if theme.motion.enable %}
|
||||
{{- next_js('motion.js') }}
|
||||
{%- endif %}
|
||||
|
||||
{%- set scheme_script = 'schemes/' + theme.scheme | lower + '.swig' %}
|
||||
{% include scheme_script %}
|
||||
|
||||
{{- next_js('next-boot.js') }}
|
||||
{%- if theme.bookmark.enable %}
|
||||
{{- next_js('bookmark.js') }}
|
||||
{%- endif %}
|
||||
{%- if theme.pjax %}
|
||||
{% include 'pjax.swig' %}
|
||||
{%- endif %}
|
||||
{% include 'three.swig' %}
|
||||
22
themes/next/layout/_scripts/noscript.swig
Normal file
22
themes/next/layout/_scripts/noscript.swig
Normal file
@ -0,0 +1,22 @@
|
||||
<noscript>
|
||||
<style>
|
||||
.use-motion .brand,
|
||||
.use-motion .menu-item,
|
||||
.sidebar-inner,
|
||||
.use-motion .post-block,
|
||||
.use-motion .pagination,
|
||||
.use-motion .comments,
|
||||
.use-motion .post-header,
|
||||
.use-motion .post-body,
|
||||
.use-motion .collection-header { opacity: initial; }
|
||||
|
||||
.use-motion .site-title,
|
||||
.use-motion .site-subtitle {
|
||||
opacity: initial;
|
||||
top: initial;
|
||||
}
|
||||
|
||||
.use-motion .logo-line-before i { left: initial; }
|
||||
.use-motion .logo-line-after i { right: initial; }
|
||||
</style>
|
||||
</noscript>
|
||||
154
themes/next/layout/_scripts/pages/schedule.swig
Normal file
154
themes/next/layout/_scripts/pages/schedule.swig
Normal file
@ -0,0 +1,154 @@
|
||||
<script{{ pjax }}>
|
||||
(function() {
|
||||
// Initialization
|
||||
var calendar = {
|
||||
orderBy : 'startTime',
|
||||
showLocation: false,
|
||||
offsetMax : 72,
|
||||
offsetMin : 4,
|
||||
showDeleted : false,
|
||||
singleEvents: true,
|
||||
maxResults : 250
|
||||
};
|
||||
|
||||
// Read config form theme config file
|
||||
Object.assign(calendar, {{ theme.calendar | json }});
|
||||
|
||||
var now = new Date();
|
||||
var timeMax = new Date();
|
||||
var timeMin = new Date();
|
||||
|
||||
timeMax.setHours(now.getHours() + calendar.offsetMax);
|
||||
timeMin.setHours(now.getHours() - calendar.offsetMin);
|
||||
|
||||
// Build URL
|
||||
const params = {
|
||||
key : calendar.api_key,
|
||||
orderBy : calendar.orderBy,
|
||||
timeMax : timeMax.toISOString(),
|
||||
timeMin : timeMin.toISOString(),
|
||||
showDeleted : calendar.showDeleted,
|
||||
singleEvents: calendar.singleEvents,
|
||||
maxResults : calendar.maxResults
|
||||
};
|
||||
|
||||
var request_url = 'https://www.googleapis.com/calendar/v3/calendars/' + calendar.calendar_id + '/events?' + Object.entries(params).map(([key, value]) => `${key}=${encodeURIComponent(value)}`).join('&');
|
||||
|
||||
fetchData();
|
||||
var fetchDataTimer = setInterval(fetchData, 60000);
|
||||
window.addEventListener('pjax:send', () => {
|
||||
clearInterval(fetchDataTimer);
|
||||
});
|
||||
|
||||
function fetchData() {
|
||||
var eventList = document.querySelector('.event-list');
|
||||
if (!eventList) return;
|
||||
|
||||
fetch(request_url).then(response => {
|
||||
return response.json();
|
||||
}).then(data => {
|
||||
if (data.items.length === 0) {
|
||||
eventList.innerHTML = '<hr>';
|
||||
return;
|
||||
}
|
||||
// Clean the event list
|
||||
eventList.innerHTML = '';
|
||||
var prevEnd = 0; // used to decide where to insert an <hr>
|
||||
|
||||
data.items.forEach(event => {
|
||||
// Parse data
|
||||
var utc = new Date().getTimezoneOffset() * 60000;
|
||||
var start = event.start.dateTime = new Date(event.start.dateTime || (new Date(event.start.date).getTime() + utc));
|
||||
var end = event.end.dateTime = new Date(event.end.dateTime || (new Date(event.end.date).getTime() + utc));
|
||||
|
||||
tense = judgeTense(now, start, end); // 0:now 1:future -1:past
|
||||
|
||||
if (tense === 1 && prevEnd < now) {
|
||||
eventList.innerHTML += '<hr>';
|
||||
}
|
||||
|
||||
eventDOM = buildEventDOM(tense, event);
|
||||
eventList.innerHTML += eventDOM;
|
||||
|
||||
prevEnd = end;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function getRelativeTime(current, previous) {
|
||||
var msPerMinute = 60 * 1000;
|
||||
var msPerHour = msPerMinute * 60;
|
||||
var msPerDay = msPerHour * 24;
|
||||
var msPerMonth = msPerDay * 30;
|
||||
var msPerYear = msPerDay * 365;
|
||||
|
||||
var elapsed = current - previous;
|
||||
var tense = elapsed > 0 ? 'ago' : 'later';
|
||||
|
||||
elapsed = Math.abs(elapsed);
|
||||
|
||||
if ( elapsed < msPerHour ) {
|
||||
return Math.round(elapsed / msPerMinute) + ' minutes ' + tense;
|
||||
}
|
||||
else if ( elapsed < msPerDay ) {
|
||||
return Math.round(elapsed / msPerHour) + ' hours ' + tense;
|
||||
}
|
||||
else if ( elapsed < msPerMonth ) {
|
||||
return 'about ' + Math.round(elapsed / msPerDay) + ' days ' + tense;
|
||||
}
|
||||
else if ( elapsed < msPerYear ) {
|
||||
return 'about ' + Math.round(elapsed / msPerMonth) + ' months ' + tense;
|
||||
}
|
||||
else {
|
||||
return 'about' + Math.round(elapsed / msPerYear) + ' years' + tense;
|
||||
}
|
||||
}
|
||||
|
||||
function judgeTense(now, eventStart, eventEnd) {
|
||||
if (eventEnd < now) { return -1; }
|
||||
else if (eventStart > now) { return 1; }
|
||||
else { return 0; }
|
||||
}
|
||||
|
||||
function buildEventDOM(tense, event) {
|
||||
var tenseClass = '';
|
||||
var start = event.start.dateTime;
|
||||
var end = event.end.dateTime;
|
||||
switch(tense) {
|
||||
case 0 : // now
|
||||
tenseClass = 'event-now';
|
||||
break;
|
||||
case 1 : // future
|
||||
tenseClass = 'event-future';
|
||||
break;
|
||||
case -1: // past
|
||||
tenseClass = 'event-past';
|
||||
break;
|
||||
default:
|
||||
throw 'Time data error';
|
||||
}
|
||||
var durationFormat = {
|
||||
weekday: 'short',
|
||||
hour : '2-digit',
|
||||
minute : '2-digit'
|
||||
};
|
||||
var relativeTimeStr = (tense === 0) ? 'NOW' : getRelativeTime(now, start);
|
||||
var durationStr = start.toLocaleTimeString([], durationFormat) + ' - ' + end.toLocaleTimeString([], durationFormat);
|
||||
|
||||
var locationDOM = '';
|
||||
if (calendar.showLocation && event.location) {
|
||||
locationDOM = '<span class="event-location event-details">' + event.location + '</span>';
|
||||
}
|
||||
|
||||
var eventContent = `<div class="event ${tenseClass}">
|
||||
<h2 class="event-summary">
|
||||
${event.summary}
|
||||
<span class="event-relative-time">${relativeTimeStr}</span>
|
||||
</h2>
|
||||
${locationDOM}
|
||||
<span class="event-duration event-details">${durationStr}</span>
|
||||
</div>`;
|
||||
return eventContent;
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
58
themes/next/layout/_scripts/pjax.swig
Normal file
58
themes/next/layout/_scripts/pjax.swig
Normal file
@ -0,0 +1,58 @@
|
||||
<script>
|
||||
var pjax = new Pjax({
|
||||
selectors: [
|
||||
'head title',
|
||||
'#page-configurations',
|
||||
'.content-wrap',
|
||||
'.post-toc-wrap',
|
||||
'.languages',
|
||||
'#pjax'
|
||||
],
|
||||
switches: {
|
||||
'.post-toc-wrap': Pjax.switches.innerHTML
|
||||
},
|
||||
analytics: false,
|
||||
cacheBust: false,
|
||||
scrollTo : !CONFIG.bookmark.enable
|
||||
});
|
||||
|
||||
window.addEventListener('pjax:success', () => {
|
||||
document.querySelectorAll('script[data-pjax], script#page-configurations, #pjax script').forEach(element => {
|
||||
var code = element.text || element.textContent || element.innerHTML || '';
|
||||
var parent = element.parentNode;
|
||||
parent.removeChild(element);
|
||||
var script = document.createElement('script');
|
||||
if (element.id) {
|
||||
script.id = element.id;
|
||||
}
|
||||
if (element.className) {
|
||||
script.className = element.className;
|
||||
}
|
||||
if (element.type) {
|
||||
script.type = element.type;
|
||||
}
|
||||
if (element.src) {
|
||||
script.src = element.src;
|
||||
// Force synchronous loading of peripheral JS.
|
||||
script.async = false;
|
||||
}
|
||||
if (element.dataset.pjax !== undefined) {
|
||||
script.dataset.pjax = '';
|
||||
}
|
||||
if (code !== '') {
|
||||
script.appendChild(document.createTextNode(code));
|
||||
}
|
||||
parent.appendChild(script);
|
||||
});
|
||||
NexT.boot.refresh();
|
||||
// Define Motion Sequence & Bootstrap Motion.
|
||||
if (CONFIG.motion.enable) {
|
||||
NexT.motion.integrator
|
||||
.init()
|
||||
.add(NexT.motion.middleWares.subMenu)
|
||||
.add(NexT.motion.middleWares.postList)
|
||||
.bootstrap();
|
||||
}
|
||||
NexT.utils.updateSidebarPosition();
|
||||
});
|
||||
</script>
|
||||
1
themes/next/layout/_scripts/schemes/gemini.swig
Normal file
1
themes/next/layout/_scripts/schemes/gemini.swig
Normal file
@ -0,0 +1 @@
|
||||
{{- next_js('schemes/pisces.js') }}
|
||||
1
themes/next/layout/_scripts/schemes/mist.swig
Normal file
1
themes/next/layout/_scripts/schemes/mist.swig
Normal file
@ -0,0 +1 @@
|
||||
{{- next_js('schemes/muse.js') }}
|
||||
1
themes/next/layout/_scripts/schemes/muse.swig
Normal file
1
themes/next/layout/_scripts/schemes/muse.swig
Normal file
@ -0,0 +1 @@
|
||||
{{- next_js('schemes/muse.js') }}
|
||||
1
themes/next/layout/_scripts/schemes/pisces.swig
Normal file
1
themes/next/layout/_scripts/schemes/pisces.swig
Normal file
@ -0,0 +1 @@
|
||||
{{- next_js('schemes/pisces.js') }}
|
||||
16
themes/next/layout/_scripts/three.swig
Normal file
16
themes/next/layout/_scripts/three.swig
Normal file
@ -0,0 +1,16 @@
|
||||
{%- if theme.three.enable %}
|
||||
{%- set three_uri = theme.vendors.three or next_vendors('three/three.min.js') %}
|
||||
<script defer src="{{ three_uri }}"></script>
|
||||
{%- if theme.three.three_waves %}
|
||||
{%- set waves_uri = theme.vendors.three_waves or next_vendors('three/three-waves.min.js') %}
|
||||
<script defer src="{{ waves_uri }}"></script>
|
||||
{%- endif %}
|
||||
{%- if theme.three.canvas_lines %}
|
||||
{%- set lines_uri = theme.vendors.canvas_lines or next_vendors('three/canvas_lines.min.js') %}
|
||||
<script defer src="{{ lines_uri }}"></script>
|
||||
{%- endif %}
|
||||
{%- if theme.three.canvas_sphere %}
|
||||
{%- set sphere_uri = theme.vendors.canvas_sphere or next_vendors('three/canvas_sphere.min.js') %}
|
||||
<script defer src="{{ sphere_uri }}"></script>
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
47
themes/next/layout/_scripts/vendors.swig
Normal file
47
themes/next/layout/_scripts/vendors.swig
Normal file
@ -0,0 +1,47 @@
|
||||
{%- set js_vendors = {} %}
|
||||
{%- set js_vendors = js_vendors | attr('anime', 'anime.min.js') %}
|
||||
|
||||
{%- if theme.pjax %}
|
||||
{%- set js_vendors = js_vendors | attr('pjax', 'pjax/pjax.min.js') %}
|
||||
{%- endif %}
|
||||
|
||||
{%- if theme.fancybox %}
|
||||
{%- set js_vendors = js_vendors | attr('jquery', '//cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js') %}
|
||||
{%- set js_vendors = js_vendors | attr('fancybox', '//cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.js') %}
|
||||
{%- endif %}
|
||||
|
||||
{%- if theme.mediumzoom %}
|
||||
{%- set js_vendors = js_vendors | attr('mediumzoom', '//cdn.jsdelivr.net/npm/medium-zoom@1/dist/medium-zoom.min.js') %}
|
||||
{%- endif %}
|
||||
|
||||
{%- if theme.lazyload %}
|
||||
{%- set js_vendors = js_vendors | attr('lazyload', '//cdn.jsdelivr.net/npm/lozad@1/dist/lozad.min.js') %}
|
||||
{%- endif %}
|
||||
|
||||
{%- if theme.pangu %}
|
||||
{%- set js_vendors = js_vendors | attr('pangu', '//cdn.jsdelivr.net/npm/pangu@4/dist/browser/pangu.min.js') %}
|
||||
{%- endif %}
|
||||
|
||||
{%- if theme.motion.enable %}
|
||||
{%- set js_vendors = js_vendors | attr('velocity', 'velocity/velocity.min.js') %}
|
||||
{%- set js_vendors = js_vendors | attr('velocity_ui', 'velocity/velocity.ui.min.js') %}
|
||||
{%- endif %}
|
||||
|
||||
{%- if theme.canvas_nest.enable %}
|
||||
{%- if theme.canvas_nest.onmobile %}
|
||||
{%- set canvas_nest_uri = theme.vendors.canvas_nest or next_vendors('canvas-nest/canvas-nest.min.js') %}
|
||||
{% else %}
|
||||
{%- set canvas_nest_uri = theme.vendors.canvas_nest_nomobile or next_vendors('canvas-nest/canvas-nest-nomobile.min.js') %}
|
||||
{%- endif %}
|
||||
<script color='{{ theme.canvas_nest.color }}' opacity='{{ theme.canvas_nest.opacity }}' zIndex='{{ theme.canvas_nest.zIndex }}' count='{{ theme.canvas_nest.count }}' src="{{ canvas_nest_uri }}"></script>
|
||||
{%- endif %}
|
||||
|
||||
{%- if theme.canvas_ribbon.enable %}
|
||||
{%- set canvas_ribbon_uri = theme.vendors.canvas_ribbon or next_vendors('canvas-ribbon/canvas-ribbon.js') %}
|
||||
<script size="{{ theme.canvas_ribbon.size }}" alpha="{{ theme.canvas_ribbon.alpha }}" zIndex="{{ theme.canvas_ribbon.zIndex }}" src="{{ canvas_ribbon_uri }}"></script>
|
||||
{%- endif %}
|
||||
|
||||
{%- for name, internal in js_vendors %}
|
||||
{%- set internal_script = next_vendors(internal) %}
|
||||
<script src="{{ theme.vendors[name] or internal_script }}"></script>
|
||||
{%- endfor %}
|
||||
11
themes/next/layout/_third-party/analytics/baidu-analytics.swig
vendored
Normal file
11
themes/next/layout/_third-party/analytics/baidu-analytics.swig
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
{%- if theme.baidu_analytics %}
|
||||
<script{{ pjax }}>
|
||||
var _hmt = _hmt || [];
|
||||
(function() {
|
||||
var hm = document.createElement("script");
|
||||
hm.src = "https://hm.baidu.com/hm.js?{{ theme.baidu_analytics }}";
|
||||
var s = document.getElementsByTagName("script")[0];
|
||||
s.parentNode.insertBefore(hm, s);
|
||||
})();
|
||||
</script>
|
||||
{%- endif %}
|
||||
31
themes/next/layout/_third-party/analytics/google-analytics.swig
vendored
Normal file
31
themes/next/layout/_third-party/analytics/google-analytics.swig
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
{%- if theme.google_analytics.tracking_id %}
|
||||
{%- if not theme.google_analytics.only_pageview %}
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id={{ theme.google_analytics.tracking_id }}"></script>
|
||||
<script{{ pjax }}>
|
||||
if (CONFIG.hostname === location.hostname) {
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
gtag('config', '{{ theme.google_analytics.tracking_id }}');
|
||||
}
|
||||
</script>
|
||||
{%- endif %}
|
||||
{%- if theme.google_analytics.only_pageview %}
|
||||
<script>
|
||||
function sendPageView() {
|
||||
if (CONFIG.hostname !== location.hostname) return;
|
||||
var uid = localStorage.getItem('uid') || (Math.random() + '.' + Math.random());
|
||||
localStorage.setItem('uid', uid);
|
||||
navigator.sendBeacon('https://www.google-analytics.com/collect', new URLSearchParams({
|
||||
v : 1,
|
||||
tid: '{{ theme.google_analytics.tracking_id }}',
|
||||
cid: uid,
|
||||
t : 'pageview',
|
||||
dp : encodeURIComponent(location.pathname)
|
||||
}));
|
||||
}
|
||||
document.addEventListener('pjax:complete', sendPageView);
|
||||
sendPageView();
|
||||
</script>
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
7
themes/next/layout/_third-party/analytics/growingio.swig
vendored
Normal file
7
themes/next/layout/_third-party/analytics/growingio.swig
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
{%- if theme.growingio_analytics %}
|
||||
<script{{ pjax }}>
|
||||
!function(e,t,n,g,i){e[i]=e[i]||function(){(e[i].q=e[i].q||[]).push(arguments)},n=t.createElement("script"),tag=t.getElementsByTagName("script")[0],n.async=1,n.src=('https:'==document.location.protocol?'https://':'http://')+g,tag.parentNode.insertBefore(n,tag)}(window,document,"script","assets.growingio.com/2.1/gio.js","gio");
|
||||
gio('init', '{{ theme.growingio_analytics }}', {});
|
||||
gio('send');
|
||||
</script>
|
||||
{%- endif %}
|
||||
3
themes/next/layout/_third-party/analytics/index.swig
vendored
Normal file
3
themes/next/layout/_third-party/analytics/index.swig
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{% include 'google-analytics.swig' %}
|
||||
{% include 'baidu-analytics.swig' %}
|
||||
{% include 'growingio.swig' %}
|
||||
27
themes/next/layout/_third-party/baidu-push.swig
vendored
Normal file
27
themes/next/layout/_third-party/baidu-push.swig
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
{%- if theme.baidu_push %}
|
||||
<script{{ pjax }}>
|
||||
(function(){
|
||||
var canonicalURL, curProtocol;
|
||||
//Get the <link> tag
|
||||
var x=document.getElementsByTagName("link");
|
||||
//Find the last canonical URL
|
||||
if(x.length > 0){
|
||||
for (i=0;i<x.length;i++){
|
||||
if(x[i].rel.toLowerCase() == 'canonical' && x[i].href){
|
||||
canonicalURL=x[i].href;
|
||||
}
|
||||
}
|
||||
}
|
||||
//Get protocol
|
||||
if (!canonicalURL){
|
||||
curProtocol = window.location.protocol.split(':')[0];
|
||||
}
|
||||
else{
|
||||
curProtocol = canonicalURL.split(':')[0];
|
||||
}
|
||||
//Get current URL if the canonical URL does not exist
|
||||
if (!canonicalURL) canonicalURL = window.location.href;
|
||||
//Assign script content. Replace current URL with the canonical URL
|
||||
!function(){var e=/([http|https]:\/\/[a-zA-Z0-9\_\.]+\.baidu\.com)/gi,r=canonicalURL,t=document.referrer;if(!e.test(r)){var n=(String(curProtocol).toLowerCase() === 'https')?"https://sp0.baidu.com/9_Q4simg2RQJ8t7jm9iCKT-xh_/s.gif":"//api.share.baidu.com/s.gif";t?(n+="?r="+encodeURIComponent(document.referrer),r&&(n+="&l="+r)):r&&(n+="?l="+r);var i=new Image;i.src=n}}(window);})();
|
||||
</script>
|
||||
{%- endif %}
|
||||
22
themes/next/layout/_third-party/chat/chatra.swig
vendored
Normal file
22
themes/next/layout/_third-party/chat/chatra.swig
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
{%- if theme.chatra.enable %}
|
||||
{%- if theme.chatra.embed %}
|
||||
<script>
|
||||
window.ChatraSetup = {
|
||||
mode : 'frame',
|
||||
injectTo: '{{ theme.chatra.embed }}'
|
||||
};
|
||||
</script>
|
||||
{%- endif %}
|
||||
<script>
|
||||
(function(d, w, c) {
|
||||
w.ChatraID = '{{ theme.chatra.id }}';
|
||||
var s = d.createElement('script');
|
||||
w[c] = w[c] || function() {
|
||||
(w[c].q = w[c].q || []).push(arguments);
|
||||
};
|
||||
s.async = {{ theme.chatra.async }};
|
||||
s.src = 'https://call.chatra.io/chatra.js';
|
||||
if (d.head) d.head.appendChild(s);
|
||||
})(document, window, 'Chatra');
|
||||
</script>
|
||||
{%- endif %}
|
||||
3
themes/next/layout/_third-party/chat/tidio.swig
vendored
Normal file
3
themes/next/layout/_third-party/chat/tidio.swig
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{%- if theme.tidio.enable %}
|
||||
<script src="//code.tidio.co/{{ theme.tidio.key }}.js"></script>
|
||||
{%- endif %}
|
||||
17
themes/next/layout/_third-party/comments/changyan.swig
vendored
Normal file
17
themes/next/layout/_third-party/comments/changyan.swig
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
{%- if is_home() %}
|
||||
<script id="cy_cmt_num" src="https://changyan.sohu.com/upload/plugins/plugins.list.count.js?clientId={{ theme.changyan.appid }}"></script>
|
||||
{% elif page.comments %}
|
||||
<script>
|
||||
NexT.utils.loadComments(document.querySelector('#SOHUCS'), () => {
|
||||
var appid = '{{ theme.changyan.appid }}';
|
||||
var conf = '{{ theme.changyan.appkey }}';
|
||||
var width = window.innerWidth || document.documentElement.clientWidth;
|
||||
if (width < 960) {
|
||||
window.document.write('<script id="changyan_mobile_js" charset="utf-8" type="text/javascript" src="https://changyan.sohu.com/upload/mobile/wap-js/changyan_mobile.js?client_id=' + appid + '&conf=' + conf + '"><\/script>');
|
||||
} else {
|
||||
var loadJs=function(d,a){var c=document.getElementsByTagName("head")[0]||document.head||document.documentElement;var b=document.createElement("script");b.setAttribute("type","text/javascript");b.setAttribute("charset","UTF-8");b.setAttribute("src",d);if(typeof a==="function"){if(window.attachEvent){b.onreadystatechange=function(){var e=b.readyState;if(e==="loaded"||e==="complete"){b.onreadystatechange=null;a()}}}else{b.onload=a}}c.appendChild(b)};loadJs("https://changyan.sohu.com/upload/changyan.js",function(){window.changyan.api.config({appid:appid,conf:conf})});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script src="https://assets.changyan.sohu.com/upload/plugins/plugins.count.js"></script>
|
||||
{%- endif %}
|
||||
37
themes/next/layout/_third-party/comments/disqus.swig
vendored
Normal file
37
themes/next/layout/_third-party/comments/disqus.swig
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
{%- if theme.disqus.count %}
|
||||
<script>
|
||||
function loadCount() {
|
||||
var d = document, s = d.createElement('script');
|
||||
s.src = 'https://{{ theme.disqus.shortname }}.disqus.com/count.js';
|
||||
s.id = 'dsq-count-scr';
|
||||
(d.head || d.body).appendChild(s);
|
||||
}
|
||||
// defer loading until the whole page loading is completed
|
||||
window.addEventListener('load', loadCount, false);
|
||||
</script>
|
||||
{%- endif %}
|
||||
{%- if page.comments %}
|
||||
<script>
|
||||
var disqus_config = function() {
|
||||
this.page.url = {{ page.permalink | json }};
|
||||
this.page.identifier = {{ page.path | json }};
|
||||
this.page.title = {{ page.title | json }};
|
||||
{% if __('disqus') !== 'disqus' -%}
|
||||
this.language = '{{ __('disqus') }}';
|
||||
{% endif -%}
|
||||
};
|
||||
NexT.utils.loadComments(document.querySelector('#disqus_thread'), () => {
|
||||
if (window.DISQUS) {
|
||||
DISQUS.reset({
|
||||
reload: true,
|
||||
config: disqus_config
|
||||
});
|
||||
} else {
|
||||
var d = document, s = d.createElement('script');
|
||||
s.src = 'https://{{ theme.disqus.shortname }}.disqus.com/embed.js';
|
||||
s.setAttribute('data-timestamp', '' + +new Date());
|
||||
(d.head || d.body).appendChild(s);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{%- endif %}
|
||||
21
themes/next/layout/_third-party/comments/disqusjs.swig
vendored
Normal file
21
themes/next/layout/_third-party/comments/disqusjs.swig
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
{%- if page.comments %}
|
||||
{%- set disqusjs_css_uri = theme.vendors.disqusjs_css or '//cdn.jsdelivr.net/npm/disqusjs@1/dist/disqusjs.css' %}
|
||||
<link rel="stylesheet" href="{{ disqusjs_css_uri }}">
|
||||
|
||||
{%- set disqusjs_js_uri = theme.vendors.disqusjs_js or '//cdn.jsdelivr.net/npm/disqusjs@1/dist/disqus.js' %}
|
||||
|
||||
<script>
|
||||
NexT.utils.loadComments(document.querySelector('#disqus_thread'), () => {
|
||||
NexT.utils.getScript('{{ disqusjs_js_uri }}', () => {
|
||||
window.dsqjs = new DisqusJS({
|
||||
api : '{{ theme.disqusjs.api }}' || 'https://disqus.com/api/',
|
||||
apikey : '{{ theme.disqusjs.apikey }}',
|
||||
shortname : '{{ theme.disqusjs.shortname }}',
|
||||
url : {{ page.permalink | json }},
|
||||
identifier: {{ page.path | json }},
|
||||
title : {{ page.title | json }},
|
||||
});
|
||||
}, window.DisqusJS);
|
||||
});
|
||||
</script>
|
||||
{%- endif %}
|
||||
28
themes/next/layout/_third-party/comments/gitalk.swig
vendored
Normal file
28
themes/next/layout/_third-party/comments/gitalk.swig
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
{%- if page.comments %}
|
||||
{%- set gitalk_css_uri = theme.vendors.gitalk_css or '//cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.css' %}
|
||||
<link rel="stylesheet" href="{{ gitalk_css_uri }}">
|
||||
|
||||
{%- set gitalk_js_uri = theme.vendors.gitalk_js or '//cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js' %}
|
||||
|
||||
<script>
|
||||
NexT.utils.loadComments(document.querySelector('#gitalk-container'), () => {
|
||||
NexT.utils.getScript('{{ gitalk_js_uri }}', () => {
|
||||
var gitalk = new Gitalk({
|
||||
clientID : '{{ theme.gitalk.client_id }}',
|
||||
clientSecret: '{{ theme.gitalk.client_secret }}',
|
||||
repo : '{{ theme.gitalk.repo }}',
|
||||
owner : '{{ theme.gitalk.github_id }}',
|
||||
admin : ['{{ theme.gitalk.admin_user }}'],
|
||||
id : '{{ gitalk_md5(page.path) }}',
|
||||
{%- if theme.gitalk.language == '' %}
|
||||
language: window.navigator.language || window.navigator.userLanguage,
|
||||
{% else %}
|
||||
language: '{{ theme.gitalk.language }}',
|
||||
{%- endif %}
|
||||
distractionFreeMode: {{ theme.gitalk.distraction_free_mode }}
|
||||
});
|
||||
gitalk.render('gitalk-container');
|
||||
}, window.Gitalk);
|
||||
});
|
||||
</script>
|
||||
{%- endif %}
|
||||
17
themes/next/layout/_third-party/comments/livere.swig
vendored
Normal file
17
themes/next/layout/_third-party/comments/livere.swig
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
{%- if page.comments %}
|
||||
<script>
|
||||
NexT.utils.loadComments(document.querySelector('#lv-container'), () => {
|
||||
window.livereOptions = {
|
||||
refer: location.pathname.replace(CONFIG.root, '').replace('index.html', '')
|
||||
};
|
||||
(function(d, s) {
|
||||
var j, e = d.getElementsByTagName(s)[0];
|
||||
if (typeof LivereTower === 'function') { return; }
|
||||
j = d.createElement(s);
|
||||
j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
|
||||
j.async = true;
|
||||
e.parentNode.insertBefore(j, e);
|
||||
})(document, 'script');
|
||||
});
|
||||
</script>
|
||||
{%- endif %}
|
||||
29
themes/next/layout/_third-party/comments/valine.swig
vendored
Normal file
29
themes/next/layout/_third-party/comments/valine.swig
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
{%- set valine_uri = theme.vendors.valine or '//unpkg.com/valine/dist/Valine.min.js' %}
|
||||
|
||||
<script>
|
||||
NexT.utils.loadComments(document.querySelector('#valine-comments'), () => {
|
||||
NexT.utils.getScript('{{ valine_uri }}', () => {
|
||||
var GUEST = ['nick', 'mail', 'link'];
|
||||
var guest = '{{ theme.valine.guest_info }}';
|
||||
guest = guest.split(',').filter(item => {
|
||||
return GUEST.includes(item);
|
||||
});
|
||||
new Valine({
|
||||
el : '#valine-comments',
|
||||
verify : {{ theme.valine.verify }},
|
||||
notify : {{ theme.valine.notify }},
|
||||
appId : '{{ theme.valine.appid }}',
|
||||
appKey : '{{ theme.valine.appkey }}',
|
||||
placeholder: {{ theme.valine.placeholder | json }},
|
||||
avatar : '{{ theme.valine.avatar }}',
|
||||
meta : guest,
|
||||
pageSize : '{{ theme.valine.pageSize }}' || 10,
|
||||
visitor : {{ theme.valine.visitor }},
|
||||
lang : '{{ theme.valine.language }}' || 'zh-cn',
|
||||
path : location.pathname,
|
||||
recordIP : {{ theme.valine.recordIP }},
|
||||
serverURLs : '{{ theme.valine.serverURLs }}'
|
||||
});
|
||||
}, window.Valine);
|
||||
});
|
||||
</script>
|
||||
17
themes/next/layout/_third-party/index.swig
vendored
Normal file
17
themes/next/layout/_third-party/index.swig
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
{% include 'baidu-push.swig' %}
|
||||
|
||||
{% include 'rating.swig' %}
|
||||
|
||||
{%- if theme.algolia_search.enable %}
|
||||
{% include 'search/algolia-search.swig' %}
|
||||
{% elif theme.swiftype_key %}
|
||||
{% include 'search/swiftype.swig' %}
|
||||
{% elif theme.local_search.enable %}
|
||||
{% include 'search/localsearch.swig' %}
|
||||
{%- endif %}
|
||||
|
||||
{% include 'chat/chatra.swig' %}
|
||||
{% include 'chat/tidio.swig' %}
|
||||
|
||||
{% include 'tags/pdf.swig' %}
|
||||
{% include 'tags/mermaid.swig' %}
|
||||
20
themes/next/layout/_third-party/math/index.swig
vendored
Normal file
20
themes/next/layout/_third-party/math/index.swig
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
{%- if theme.math.mathjax.enable or theme.math.katex.enable %}
|
||||
{%- set is_index_has_math = false %}
|
||||
|
||||
{# At home, check if there has `mathjax: true` post #}
|
||||
{%- if is_home() and theme.math.per_page %}
|
||||
{%- for post in page.posts.toArray() %}
|
||||
{%- if post.mathjax and not is_index_has_math %}
|
||||
{%- set is_index_has_math = true %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
|
||||
{%- if not theme.math.per_page or is_index_has_math or page.mathjax %}
|
||||
{%- if theme.math.mathjax.enable %}
|
||||
{% include '_third-party/math/mathjax.swig' %}
|
||||
{% elif theme.math.katex.enable %}
|
||||
{% include '_third-party/math/katex.swig' %}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
8
themes/next/layout/_third-party/math/katex.swig
vendored
Normal file
8
themes/next/layout/_third-party/math/katex.swig
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
{%- set katex_uri = theme.vendors.katex or '//cdn.jsdelivr.net/npm/katex@0/dist/katex.min.css' %}
|
||||
<link rel="stylesheet" href="{{ katex_uri }}">
|
||||
{%- if theme.math.katex.copy_tex %}
|
||||
{%- set copy_tex_js_uri = theme.vendors.copy_tex_js or '//cdn.jsdelivr.net/npm/katex@0/dist/contrib/copy-tex.min.js' %}
|
||||
{%- set copy_tex_css_uri = theme.vendors.copy_tex_css or '//cdn.jsdelivr.net/npm/katex@0/dist/contrib/copy-tex.min.css' %}
|
||||
<script src="{{ copy_tex_js_uri }}"></script>
|
||||
<link rel="stylesheet" href="{{ copy_tex_css_uri }}">
|
||||
{%- endif %}
|
||||
57
themes/next/layout/_third-party/math/mathjax.swig
vendored
Normal file
57
themes/next/layout/_third-party/math/mathjax.swig
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
{%- set mathjax_uri = theme.vendors.mathjax or '//cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js' %}
|
||||
|
||||
<script>
|
||||
if (typeof MathJax === 'undefined') {
|
||||
window.MathJax = {
|
||||
loader: {
|
||||
{%- if theme.math.mathjax.mhchem %}
|
||||
load: ['[tex]/mhchem'],
|
||||
{%- endif %}
|
||||
source: {
|
||||
'[tex]/amsCd': '[tex]/amscd',
|
||||
'[tex]/AMScd': '[tex]/amscd'
|
||||
}
|
||||
},
|
||||
tex: {
|
||||
inlineMath: {'[+]': [['$', '$']]},
|
||||
{%- if theme.math.mathjax.mhchem %}
|
||||
packages: {'[+]': ['mhchem']},
|
||||
{%- endif %}
|
||||
tags: 'ams'
|
||||
},
|
||||
options: {
|
||||
renderActions: {
|
||||
findScript: [10, doc => {
|
||||
document.querySelectorAll('script[type^="math/tex"]').forEach(node => {
|
||||
const display = !!node.type.match(/; *mode=display/);
|
||||
const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display);
|
||||
const text = document.createTextNode('');
|
||||
node.parentNode.replaceChild(text, node);
|
||||
math.start = {node: text, delim: '', n: 0};
|
||||
math.end = {node: text, delim: '', n: 0};
|
||||
doc.math.push(math);
|
||||
});
|
||||
}, '', false],
|
||||
insertedScript: [200, () => {
|
||||
document.querySelectorAll('mjx-container').forEach(node => {
|
||||
let target = node.parentNode;
|
||||
if (target.nodeName.toLowerCase() === 'li') {
|
||||
target.parentNode.classList.add('has-jax');
|
||||
}
|
||||
});
|
||||
}, '', false]
|
||||
}
|
||||
}
|
||||
};
|
||||
(function () {
|
||||
var script = document.createElement('script');
|
||||
script.src = '{{ mathjax_uri }}';
|
||||
script.defer = true;
|
||||
document.head.appendChild(script);
|
||||
})();
|
||||
} else {
|
||||
MathJax.startup.document.state(0);
|
||||
MathJax.texReset();
|
||||
MathJax.typeset();
|
||||
}
|
||||
</script>
|
||||
17
themes/next/layout/_third-party/quicklink.swig
vendored
Normal file
17
themes/next/layout/_third-party/quicklink.swig
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
{%- if page.quicklink.enable %}
|
||||
{%- set quicklink_uri = theme.vendors.quicklink or next_vendors('//cdn.jsdelivr.net/npm/quicklink@1/dist/quicklink.umd.js') %}
|
||||
<script src="{{ quicklink_uri }}"></script>
|
||||
<script>
|
||||
{%- if page.quicklink.delay %}
|
||||
window.addEventListener('load', () => {
|
||||
{%- endif %}
|
||||
quicklink({
|
||||
timeout : {{ page.quicklink.timeout }},
|
||||
priority: {{ page.quicklink.priority }},
|
||||
ignores : [uri => uri.includes('#'),uri => uri === '{{ url | replace('index.html', '') }}',{{ page.quicklink.ignores }}]
|
||||
});
|
||||
{%- if page.quicklink.delay %}
|
||||
});
|
||||
{%- endif %}
|
||||
</script>
|
||||
{%- endif %}
|
||||
22
themes/next/layout/_third-party/rating.swig
vendored
Normal file
22
themes/next/layout/_third-party/rating.swig
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
{%- if theme.rating.enable %}
|
||||
<script{{ pjax }}>
|
||||
if (CONFIG.page.isPost) {
|
||||
wpac_init = window.wpac_init || [];
|
||||
wpac_init.push({
|
||||
widget: 'Rating',
|
||||
id : {{ theme.rating.id }},
|
||||
el : 'wpac-rating',
|
||||
color : '{{ theme.rating.color }}'
|
||||
});
|
||||
(function() {
|
||||
if ('WIDGETPACK_LOADED' in window) return;
|
||||
WIDGETPACK_LOADED = true;
|
||||
var mc = document.createElement('script');
|
||||
mc.type = 'text/javascript';
|
||||
mc.async = true;
|
||||
mc.src = '//embed.widgetpack.com/widget.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(mc, s.nextSibling);
|
||||
})();
|
||||
}
|
||||
</script>
|
||||
{%- endif %}
|
||||
6
themes/next/layout/_third-party/search/algolia-search.swig
vendored
Normal file
6
themes/next/layout/_third-party/search/algolia-search.swig
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
{%- set algolia_search_uri = theme.vendors.algolia_search or next_vendors('//cdn.jsdelivr.net/npm/algoliasearch@4/dist/algoliasearch-lite.umd.js') %}
|
||||
{%- set instant_search_uri = theme.vendors.instant_search or next_vendors('//cdn.jsdelivr.net/npm/instantsearch.js@4/dist/instantsearch.production.min.js') %}
|
||||
<script src="{{ algolia_search_uri }}"></script>
|
||||
<script src="{{ instant_search_uri }}"></script>
|
||||
|
||||
{{- next_js('algolia-search.js') }}
|
||||
1
themes/next/layout/_third-party/search/localsearch.swig
vendored
Normal file
1
themes/next/layout/_third-party/search/localsearch.swig
vendored
Normal file
@ -0,0 +1 @@
|
||||
{{- next_js('local-search.js') }}
|
||||
8
themes/next/layout/_third-party/search/swiftype.swig
vendored
Normal file
8
themes/next/layout/_third-party/search/swiftype.swig
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
<script>
|
||||
(function(w,d,t,u,n,s,e){w['SwiftypeObject']=n;w[n]=w[n]||function(){
|
||||
(w[n].q=w[n].q||[]).push(arguments);};s=d.createElement(t);
|
||||
e=d.getElementsByTagName(t)[0];s.async=1;s.src=u;e.parentNode.insertBefore(s,e);
|
||||
})(window,document,'script','//s.swiftypecdn.com/install/v2/st.js','_st');
|
||||
|
||||
_st('install','{{ theme.swiftype_key }}','2.0.0');
|
||||
</script>
|
||||
31
themes/next/layout/_third-party/statistics/busuanzi-counter.swig
vendored
Normal file
31
themes/next/layout/_third-party/statistics/busuanzi-counter.swig
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
{%- if theme.busuanzi_count.enable %}
|
||||
<div class="busuanzi-count">
|
||||
<script{{ pjax }} async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
|
||||
|
||||
{%- if theme.busuanzi_count.total_visitors %}
|
||||
<span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
|
||||
<span class="post-meta-item-icon">
|
||||
<i class="{{ theme.busuanzi_count.total_visitors_icon }}"></i>
|
||||
</span>
|
||||
<span class="site-uv" title="{{ __('footer.total_visitors') }}">
|
||||
<span id="busuanzi_value_site_uv"></span>
|
||||
</span>
|
||||
</span>
|
||||
{%- endif %}
|
||||
|
||||
{%- if theme.busuanzi_count.total_visitors and theme.busuanzi_count.total_views %}
|
||||
<span class="post-meta-divider">|</span>
|
||||
{%- endif %}
|
||||
|
||||
{%- if theme.busuanzi_count.total_views %}
|
||||
<span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
|
||||
<span class="post-meta-item-icon">
|
||||
<i class="{{ theme.busuanzi_count.total_views_icon }}"></i>
|
||||
</span>
|
||||
<span class="site-pv" title="{{ __('footer.total_views') }}">
|
||||
<span id="busuanzi_value_site_pv"></span>
|
||||
</span>
|
||||
</span>
|
||||
{%- endif %}
|
||||
</div>
|
||||
{%- endif %}
|
||||
5
themes/next/layout/_third-party/statistics/cnzz-analytics.swig
vendored
Normal file
5
themes/next/layout/_third-party/statistics/cnzz-analytics.swig
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
{%- if theme.cnzz_siteid %}
|
||||
<div style="display: none;">
|
||||
<script{{ pjax }} src="//s95.cnzz.com/z_stat.php?id={{ theme.cnzz_siteid }}&web_id={{ theme.cnzz_siteid }}"></script>
|
||||
</div>
|
||||
{%- endif %}
|
||||
73
themes/next/layout/_third-party/statistics/firestore.swig
vendored
Normal file
73
themes/next/layout/_third-party/statistics/firestore.swig
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
{%- if theme.firestore.enable %}
|
||||
<script src="https://www.gstatic.com/firebasejs/6.3.3/firebase-app.js"></script>
|
||||
<script src="https://www.gstatic.com/firebasejs/6.3.3/firebase-firestore.js"></script>
|
||||
<script>
|
||||
firebase.initializeApp({
|
||||
apiKey : '{{ theme.firestore.apiKey }}',
|
||||
projectId: '{{ theme.firestore.projectId }}'
|
||||
});
|
||||
|
||||
function getCount(doc, increaseCount) {
|
||||
// IncreaseCount will be false when not in article page
|
||||
return doc.get().then(d => {
|
||||
var count = 0;
|
||||
if (!d.exists) { // Has no data, initialize count
|
||||
if (increaseCount) {
|
||||
doc.set({
|
||||
count: 1
|
||||
});
|
||||
count = 1;
|
||||
}
|
||||
} else { // Has data
|
||||
count = d.data().count;
|
||||
if (increaseCount) {
|
||||
// If first view this article
|
||||
doc.set({ // Increase count
|
||||
count: count + 1
|
||||
});
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
});
|
||||
}
|
||||
|
||||
function appendCountTo(el) {
|
||||
return count => {
|
||||
el.innerText = count;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<script{{ pjax }}>
|
||||
(function() {
|
||||
var db = firebase.firestore();
|
||||
var articles = db.collection('{{ theme.firestore.collection }}');
|
||||
|
||||
if (CONFIG.page.isPost) { // Is article page
|
||||
var title = document.querySelector('.post-title').innerText.trim();
|
||||
var doc = articles.doc(title);
|
||||
var increaseCount = CONFIG.hostname === location.hostname;
|
||||
if (localStorage.getItem(title)) {
|
||||
increaseCount = false;
|
||||
} else {
|
||||
// Mark as visited
|
||||
localStorage.setItem(title, true);
|
||||
}
|
||||
getCount(doc, increaseCount).then(appendCountTo(document.querySelector('.firestore-visitors-count')));
|
||||
} else if (CONFIG.page.isHome) { // Is index page
|
||||
var promises = [...document.querySelectorAll('.post-title')].map(element => {
|
||||
var title = element.innerText.trim();
|
||||
var doc = articles.doc(title);
|
||||
return getCount(doc);
|
||||
});
|
||||
Promise.all(promises).then(counts => {
|
||||
var metas = document.querySelectorAll('.firestore-visitors-count');
|
||||
counts.forEach((val, idx) => {
|
||||
appendCountTo(metas[idx])(val);
|
||||
});
|
||||
});
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
{%- endif %}
|
||||
4
themes/next/layout/_third-party/statistics/index.swig
vendored
Normal file
4
themes/next/layout/_third-party/statistics/index.swig
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
{% include 'busuanzi-counter.swig' %}
|
||||
{% include 'cnzz-analytics.swig' %}
|
||||
{% include 'firestore.swig' %}
|
||||
{% include 'lean-analytics.swig' %}
|
||||
99
themes/next/layout/_third-party/statistics/lean-analytics.swig
vendored
Normal file
99
themes/next/layout/_third-party/statistics/lean-analytics.swig
vendored
Normal file
@ -0,0 +1,99 @@
|
||||
{%- if theme.leancloud_visitors.enable and not theme.valine.visitor %}
|
||||
<script{{ pjax }}>
|
||||
(function() {
|
||||
function leancloudSelector(url) {
|
||||
url = encodeURI(url);
|
||||
return document.getElementById(url).querySelector('.leancloud-visitors-count');
|
||||
}
|
||||
|
||||
function addCount(Counter) {
|
||||
var visitors = document.querySelector('.leancloud_visitors');
|
||||
var url = decodeURI(visitors.id);
|
||||
var title = visitors.dataset.flagTitle;
|
||||
|
||||
Counter('get', '/classes/Counter?where=' + encodeURIComponent(JSON.stringify({ url })))
|
||||
.then(response => response.json())
|
||||
.then(({ results }) => {
|
||||
if (results.length > 0) {
|
||||
var counter = results[0];
|
||||
leancloudSelector(url).innerText = counter.time + 1;
|
||||
Counter('put', '/classes/Counter/' + counter.objectId, { time: { '__op': 'Increment', 'amount': 1 } })
|
||||
.catch(error => {
|
||||
console.error('Failed to save visitor count', error);
|
||||
});
|
||||
} else {
|
||||
{%- if theme.leancloud_visitors.security %}
|
||||
leancloudSelector(url).innerText = 'Counter not initialized! More info at console err msg.';
|
||||
console.error('ATTENTION! LeanCloud counter has security bug, see how to solve it here: https://github.com/theme-next/hexo-leancloud-counter-security. \n However, you can still use LeanCloud without security, by setting `security` option to `false`.');
|
||||
{% else %}
|
||||
Counter('post', '/classes/Counter', { title, url, time: 1 })
|
||||
.then(response => response.json())
|
||||
.then(() => {
|
||||
leancloudSelector(url).innerText = 1;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Failed to create', error);
|
||||
});
|
||||
{%- endif %}
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('LeanCloud Counter Error', error);
|
||||
});
|
||||
}
|
||||
|
||||
function showTime(Counter) {
|
||||
var visitors = document.querySelectorAll('.leancloud_visitors');
|
||||
var entries = [...visitors].map(element => {
|
||||
return decodeURI(element.id);
|
||||
});
|
||||
|
||||
Counter('get', '/classes/Counter?where=' + encodeURIComponent(JSON.stringify({ url: { '$in': entries } })))
|
||||
.then(response => response.json())
|
||||
.then(({ results }) => {
|
||||
for (let url of entries) {
|
||||
let target = results.find(item => item.url === url);
|
||||
leancloudSelector(url).innerText = target ? target.time : 0;
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('LeanCloud Counter Error', error);
|
||||
});
|
||||
}
|
||||
|
||||
let { app_id, app_key, server_url } = {{ theme.leancloud_visitors | json }};
|
||||
function fetchData(api_server) {
|
||||
var Counter = (method, url, data) => {
|
||||
return fetch(`${api_server}/1.1${url}`, {
|
||||
method,
|
||||
headers: {
|
||||
'X-LC-Id' : app_id,
|
||||
'X-LC-Key' : app_key,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(data)
|
||||
});
|
||||
};
|
||||
if (CONFIG.page.isPost) {
|
||||
if (CONFIG.hostname !== location.hostname) return;
|
||||
addCount(Counter);
|
||||
} else if (document.querySelectorAll('.post-title-link').length >= 1) {
|
||||
showTime(Counter);
|
||||
}
|
||||
}
|
||||
|
||||
let api_server = app_id.slice(-9) !== '-MdYXbMMI' ? server_url : `https://${app_id.slice(0, 8).toLowerCase()}.api.lncldglobal.com`;
|
||||
|
||||
if (api_server) {
|
||||
fetchData(api_server);
|
||||
} else {
|
||||
fetch('https://app-router.leancloud.cn/2/route?appId=' + app_id)
|
||||
.then(response => response.json())
|
||||
.then(({ api_server }) => {
|
||||
fetchData('https://' + api_server);
|
||||
});
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
|
||||
{%- endif %}
|
||||
16
themes/next/layout/_third-party/tags/mermaid.swig
vendored
Normal file
16
themes/next/layout/_third-party/tags/mermaid.swig
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
{%- if theme.mermaid.enable %}
|
||||
{%- set mermaid_uri = theme.vendors.mermaid or '//cdn.jsdelivr.net/npm/mermaid@8/dist/mermaid.min.js' %}
|
||||
<script{{ pjax }}>
|
||||
if (document.querySelectorAll('pre.mermaid').length) {
|
||||
NexT.utils.getScript('{{ mermaid_uri }}', () => {
|
||||
mermaid.initialize({
|
||||
theme : '{{ theme.mermaid.theme }}',
|
||||
logLevel : 3,
|
||||
flowchart: { curve : 'linear' },
|
||||
gantt : { axisFormat: '%m/%d/%Y' },
|
||||
sequence : { actorMargin: 50 }
|
||||
});
|
||||
}, window.mermaid);
|
||||
}
|
||||
</script>
|
||||
{%- endif %}
|
||||
23
themes/next/layout/_third-party/tags/pdf.swig
vendored
Normal file
23
themes/next/layout/_third-party/tags/pdf.swig
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
{%- if theme.pdf.enable %}
|
||||
{%- set pdf_uri = next_vendors('pdf/web/viewer.html') %}
|
||||
<script{{ pjax }}>
|
||||
document.querySelectorAll('.pdfobject-container').forEach(element => {
|
||||
let url = element.dataset.target;
|
||||
let pdfOpenParams = {
|
||||
navpanes : 0,
|
||||
toolbar : 0,
|
||||
statusbar: 0,
|
||||
pagemode : 'thumbs',
|
||||
view : 'FitH'
|
||||
};
|
||||
let pdfOpenFragment = '#' + Object.entries(pdfOpenParams).map(([key, value]) => `${key}=${encodeURIComponent(value)}`).join('&');
|
||||
let fullURL = `{{ pdf_uri }}?file=${encodeURIComponent(url)}${pdfOpenFragment}`;
|
||||
|
||||
if (NexT.utils.supportsPDFs()) {
|
||||
element.innerHTML = `<embed class="pdfobject" src="${url + pdfOpenFragment}" type="application/pdf" style="height: ${element.dataset.height};">`;
|
||||
} else {
|
||||
element.innerHTML = `<iframe src="${fullURL}" style="height: ${element.dataset.height};" frameborder="0"></iframe>`;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{%- endif %}
|
||||
48
themes/next/layout/archive.swig
Normal file
48
themes/next/layout/archive.swig
Normal file
@ -0,0 +1,48 @@
|
||||
{% extends '_layout.swig' %}
|
||||
{% import '_macro/post-collapse.swig' as post_template with context %}
|
||||
{% import '_macro/sidebar.swig' as sidebar_template with context %}
|
||||
|
||||
{% block title %}{{ __('title.archive') }} | {{ title }}{% endblock %}
|
||||
|
||||
{% block class %}archive{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{#####################}
|
||||
{### ARCHIVE BLOCK ###}
|
||||
{#####################}
|
||||
<div class="post-block">
|
||||
<div class="posts-collapse">
|
||||
<div class="collection-title">
|
||||
{%- set posts_length = site.posts.length %}
|
||||
{%- if posts_length > 210 %}
|
||||
{%- set cheers = 'excellent' %}
|
||||
{% elif posts_length > 130 %}
|
||||
{%- set cheers = 'great' %}
|
||||
{% elif posts_length > 80 %}
|
||||
{%- set cheers = 'good' %}
|
||||
{% elif posts_length > 50 %}
|
||||
{%- set cheers = 'nice' %}
|
||||
{% elif posts_length > 30 %}
|
||||
{%- set cheers = 'ok' %}
|
||||
{% else %}
|
||||
{%- set cheers = 'um' %}
|
||||
{%- endif %}
|
||||
<span class="collection-header">{{ __('cheers.' + cheers) }}! {{ _p('counter.archive_posts', site.posts.length) }} {{ __('keep_on') }}</span>
|
||||
</div>
|
||||
|
||||
{{ post_template.render(page.posts) }}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{#########################}
|
||||
{### END ARCHIVE BLOCK ###}
|
||||
{#########################}
|
||||
|
||||
{% include '_partials/pagination.swig' %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block sidebar %}
|
||||
{{ sidebar_template.render(false) }}
|
||||
{% endblock %}
|
||||
36
themes/next/layout/category.swig
Normal file
36
themes/next/layout/category.swig
Normal file
@ -0,0 +1,36 @@
|
||||
{% extends '_layout.swig' %}
|
||||
{% import '_macro/post-collapse.swig' as post_template with context %}
|
||||
{% import '_macro/sidebar.swig' as sidebar_template with context %}
|
||||
|
||||
{% block title %}{{ __('title.category') }}: {{ page.category }} | {{ title }}{% endblock %}
|
||||
|
||||
{% block class %}category{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{######################}
|
||||
{### CATEGORY BLOCK ###}
|
||||
{######################}
|
||||
<div class="post-block">
|
||||
<div class="posts-collapse">
|
||||
<div class="collection-title">
|
||||
<h2 class="collection-header">
|
||||
{{- page.category }}
|
||||
<small>{{ __('title.category') }}</small>
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
{{ post_template.render(page.posts) }}
|
||||
</div>
|
||||
</div>
|
||||
{##########################}
|
||||
{### END CATEGORY BLOCK ###}
|
||||
{##########################}
|
||||
|
||||
{% include '_partials/pagination.swig' %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block sidebar %}
|
||||
{{ sidebar_template.render(false) }}
|
||||
{% endblock %}
|
||||
20
themes/next/layout/index.swig
Normal file
20
themes/next/layout/index.swig
Normal file
@ -0,0 +1,20 @@
|
||||
{% extends '_layout.swig' %}
|
||||
{% import '_macro/sidebar.swig' as sidebar_template with context %}
|
||||
|
||||
{% block title %}{{ title }}{%- if theme.index_with_subtitle and subtitle %} - {{ subtitle }}{%- endif %}{% endblock %}
|
||||
|
||||
{% block class %}index posts-expand{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{%- for post in page.posts.toArray() %}
|
||||
{{ partial('_macro/post.swig', {post: post, is_index: true}) }}
|
||||
{%- endfor %}
|
||||
|
||||
{% include '_partials/pagination.swig' %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block sidebar %}
|
||||
{{ sidebar_template.render(false) }}
|
||||
{% endblock %}
|
||||
77
themes/next/layout/page.swig
Normal file
77
themes/next/layout/page.swig
Normal file
@ -0,0 +1,77 @@
|
||||
{% extends '_layout.swig' %}
|
||||
{% import '_macro/sidebar.swig' as sidebar_template with context %}
|
||||
|
||||
{% block title %}
|
||||
{%- set page_title_suffix = ' | ' + title %}
|
||||
|
||||
{%- if page.type === 'categories' and not page.title %}
|
||||
{{- __('title.category') + page_title_suffix }}
|
||||
{%- elif page.type === 'tags' and not page.title %}
|
||||
{{- __('title.tag') + page_title_suffix }}
|
||||
{%- elif page.type === 'schedule' and not page.title %}
|
||||
{{- __('title.schedule') + page_title_suffix }}
|
||||
{%- else %}
|
||||
{{- page.title + page_title_suffix }}
|
||||
{%- endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block class %}page posts-expand{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{##################}
|
||||
{### PAGE BLOCK ###}
|
||||
{##################}
|
||||
<div class="post-block" lang="{{ page.lang or config.language }}">
|
||||
{% include '_partials/page/page-header.swig' %}
|
||||
{#################}
|
||||
{### PAGE BODY ###}
|
||||
{#################}
|
||||
<div class="post-body{%- if page.direction and page.direction.toLowerCase() === 'rtl' %} rtl{%- endif %}">
|
||||
{%- if page.type === 'tags' %}
|
||||
<div class="tag-cloud">
|
||||
<div class="tag-cloud-title">
|
||||
{{ _p('counter.tag_cloud', site.tags.length) }}
|
||||
</div>
|
||||
<div class="tag-cloud-tags">
|
||||
{{ tagcloud({
|
||||
min_font : theme.tagcloud.min,
|
||||
max_font : theme.tagcloud.max,
|
||||
amount : theme.tagcloud.amount,
|
||||
color : true,
|
||||
start_color: theme.tagcloud.start,
|
||||
end_color : theme.tagcloud.end})
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
{% elif page.type === 'categories' %}
|
||||
<div class="category-all-page">
|
||||
<div class="category-all-title">
|
||||
{{ _p('counter.categories', site.categories.length) }}
|
||||
</div>
|
||||
<div class="category-all">
|
||||
{{ list_categories() }}
|
||||
</div>
|
||||
</div>
|
||||
{% elif page.type === 'schedule' %}
|
||||
<div class="event-list">
|
||||
</div>
|
||||
{% include '_scripts/pages/schedule.swig' %}
|
||||
{% else %}
|
||||
{{ page.content }}
|
||||
{%- endif %}
|
||||
</div>
|
||||
{#####################}
|
||||
{### END PAGE BODY ###}
|
||||
{#####################}
|
||||
</div>
|
||||
{% include '_partials/page/breadcrumb.swig' %}
|
||||
{######################}
|
||||
{### END PAGE BLOCK ###}
|
||||
{######################}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block sidebar %}
|
||||
{{ sidebar_template.render(true) }}
|
||||
{% endblock %}
|
||||
16
themes/next/layout/post.swig
Normal file
16
themes/next/layout/post.swig
Normal file
@ -0,0 +1,16 @@
|
||||
{% extends '_layout.swig' %}
|
||||
{% import '_macro/sidebar.swig' as sidebar_template with context %}
|
||||
|
||||
{% block title %}{{ page.title }} | {{ title }}{% endblock %}
|
||||
|
||||
{% block class %}post posts-expand{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{{ partial('_macro/post.swig', {post: page}) }}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block sidebar %}
|
||||
{{ sidebar_template.render(true) }}
|
||||
{% endblock %}
|
||||
36
themes/next/layout/tag.swig
Normal file
36
themes/next/layout/tag.swig
Normal file
@ -0,0 +1,36 @@
|
||||
{% extends '_layout.swig' %}
|
||||
{% import '_macro/post-collapse.swig' as post_template with context %}
|
||||
{% import '_macro/sidebar.swig' as sidebar_template with context %}
|
||||
|
||||
{% block title %}{{ __('title.tag') }}: {{ page.tag }} | {{ title }}{% endblock %}
|
||||
|
||||
{% block class %}tag{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{#################}
|
||||
{### TAG BLOCK ###}
|
||||
{#################}
|
||||
<div class="post-block">
|
||||
<div class="posts-collapse">
|
||||
<div class="collection-title">
|
||||
<h2 class="collection-header">
|
||||
{{- page.tag }}
|
||||
<small>{{ __('title.tag') }}</small>
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
{{ post_template.render(page.posts) }}
|
||||
</div>
|
||||
</div>
|
||||
{#####################}
|
||||
{### END TAG BLOCK ###}
|
||||
{#####################}
|
||||
|
||||
{% include '_partials/pagination.swig' %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block sidebar %}
|
||||
{{ sidebar_template.render(false) }}
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user