initial
This commit is contained in:
3
themes/next/layout/_custom/head.swig
Normal file
3
themes/next/layout/_custom/head.swig
Normal file
@ -0,0 +1,3 @@
|
||||
{#
|
||||
Custom head.
|
||||
#}
|
1
themes/next/layout/_custom/header.swig
Normal file
1
themes/next/layout/_custom/header.swig
Normal file
@ -0,0 +1 @@
|
||||
|
1
themes/next/layout/_custom/sidebar.swig
Normal file
1
themes/next/layout/_custom/sidebar.swig
Normal file
@ -0,0 +1 @@
|
||||
|
126
themes/next/layout/_layout.swig
Normal file
126
themes/next/layout/_layout.swig
Normal file
@ -0,0 +1,126 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
{# NexT version #}
|
||||
{% set version = next_env('version') %}
|
||||
|
||||
{# Language & Config #}
|
||||
{% set title = __('title') !== 'title' && __('title') || config.title %}
|
||||
{% set subtitle = __('subtitle') !== 'subtitle' && __('subtitle') || config.subtitle %}
|
||||
{% set author = __('author') !== 'author' && __('author') || config.author %}
|
||||
{% set description = __('description') !== 'description' && __('description') || config.description %}
|
||||
|
||||
{% set html_class = 'theme-next ' + theme.scheme %}
|
||||
{% if theme.motion.enable %}
|
||||
{% set html_class = html_class + ' use-motion' %}
|
||||
{% endif %}
|
||||
|
||||
<html class="{{ html_class | lower }}" lang="{{ config.language }}">
|
||||
<head>
|
||||
{{ partial('_partials/head/head.swig', {}, {cache: theme.cache.enable}) }}
|
||||
{% include '_partials/head/head-unique.swig' %}
|
||||
<title>{% block title %}{% endblock %}</title>
|
||||
{% include '_third-party/analytics/index.swig' %}
|
||||
{{ partial('_scripts/noscript.swig', {}, {cache: theme.cache.enable}) }}
|
||||
</head>
|
||||
|
||||
<body itemscope itemtype="http://schema.org/WebPage" lang="{{ page.lang || page.language || config.language }}">
|
||||
|
||||
{% set container_class = 'container' %}
|
||||
{% if theme.sidebar.position %}
|
||||
{% set container_class = container_class + ' sidebar-position-' + theme.sidebar.position %}
|
||||
{% endif %}
|
||||
|
||||
<div class="{{ container_class }} {% block page_class %}{% endblock %}">
|
||||
<div class="headband"></div>
|
||||
|
||||
<header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
|
||||
<div class="header-inner">{% include '_partials/header/index.swig' %}</div>
|
||||
</header>
|
||||
|
||||
{{ partial('_partials/github-banner.swig', {}, {cache: theme.cache.enable}) }}
|
||||
|
||||
<main id="main" class="main">
|
||||
<div class="main-inner">
|
||||
<div class="content-wrap">
|
||||
{% if theme.scheme === 'Pisces' || theme.scheme === 'Gemini' %}
|
||||
{% include '_partials/header/sub-menu.swig' %}
|
||||
{% endif %}
|
||||
<div id="content" class="content">
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
{% include '_partials/comments.swig' %}
|
||||
</div>
|
||||
{% if theme.sidebar.display !== 'remove' %}
|
||||
{% block sidebar %}{% endblock %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<footer id="footer" class="footer">
|
||||
<div class="footer-inner">
|
||||
{{ partial('_partials/footer.swig', {}, {cache: theme.cache.enable}) }}
|
||||
{% include '_third-party/analytics/analytics-with-widget.swig' %}
|
||||
{% block footer %}{% endblock %}
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
{% if theme.back2top.enable and not theme.back2top.sidebar %}
|
||||
<div class="back-to-top">
|
||||
<i class="fa fa-arrow-up"></i>
|
||||
{% if theme.back2top.scrollpercent %}
|
||||
<span id="scrollpercent"><span>0</span>%</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if theme.needmoreshare2.enable and theme.needmoreshare2.float.enable %}
|
||||
<div id="needsharebutton-float">
|
||||
<span class="btn">
|
||||
<i class="fa fa-share-alt" aria-hidden="true"></i>
|
||||
</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if theme.baidushare and theme.baidushare.type === "slide" %}
|
||||
<div>
|
||||
{% include '_partials/share/baidushare.swig' %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if theme.add_this_id %}
|
||||
<div>
|
||||
{% include '_partials/share/add-this.swig' %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% include '_scripts/vendors.swig' %}
|
||||
{% include '_scripts/commons.swig' %}
|
||||
|
||||
{% set scheme_script = '_scripts/schemes/' + theme.scheme | lower + '.swig' %}
|
||||
{% include scheme_script %}
|
||||
|
||||
{% block script_extra %}{% endblock %}
|
||||
|
||||
{% include '_scripts/next-boot.swig' %}
|
||||
{% include '_scripts/scroll-cookie.swig' %}
|
||||
{% include '_scripts/exturl.swig' %}
|
||||
{% include '_third-party/quicklink.swig' %}
|
||||
{% include '_third-party/comments/index.swig' %}
|
||||
{% include '_third-party/search/index.swig' %}
|
||||
{% include '_third-party/analytics/lean-analytics.swig' %}
|
||||
{% include '_third-party/analytics/firestore.swig' %}
|
||||
{% include '_third-party/math/index.swig' %}
|
||||
{% include '_third-party/pdf.swig' %}
|
||||
{% include '_third-party/mermaid.swig' %}
|
||||
{% include '_third-party/baidu-push.swig' %}
|
||||
{% include '_third-party/schedule.swig' %}
|
||||
{% include '_third-party/needsharebutton.swig' %}
|
||||
{% include '_third-party/rating.swig' %}
|
||||
{% include '_third-party/pangu.swig' %}
|
||||
{% include '_third-party/bookmark.swig' %}
|
||||
{% include '_third-party/copy-code.swig' %}
|
||||
{% include '_third-party/chatra.swig' %}
|
||||
{% include '_third-party/tidio.swig' %}
|
||||
</body>
|
||||
</html>
|
14
themes/next/layout/_macro/menu/menu-badge.swig
Normal file
14
themes/next/layout/_macro/menu/menu-badge.swig
Normal file
@ -0,0 +1,14 @@
|
||||
{% macro render(name) %}
|
||||
|
||||
{% set badges = {
|
||||
archives: site.posts.length,
|
||||
categories: site.categories.length,
|
||||
tags: site.tags.length }
|
||||
%}
|
||||
{% for menu, count in badges %}
|
||||
{% if name == menu %}
|
||||
<span class="badge">{{ count }}</span>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% endmacro %}
|
24
themes/next/layout/_macro/menu/menu-item.swig
Normal file
24
themes/next/layout/_macro/menu/menu-item.swig
Normal file
@ -0,0 +1,24 @@
|
||||
{% macro render(name, value) %}
|
||||
{% import 'menu-badge.swig' as menu_badge %}
|
||||
|
||||
{% set itemURL = value.split('||')[0] | trim %}
|
||||
{% if itemURL.indexOf('http') != 0 %}
|
||||
{% set itemURL = itemURL | replace('//', '/', 'g') %}
|
||||
{% endif %}
|
||||
<li class="menu-item menu-item-{{ itemName | replace(' ', '-', 'g') }}{{ item_active(itemURL, 'menu-item-active') }}">
|
||||
|
||||
{% set menuText = __('menu.' + name) | replace('menu.', '') %}
|
||||
{% set menuURL = itemURL %}
|
||||
{% if theme.menu_settings.icons %}
|
||||
{% set menuIcon = '<i class="menu-item-icon fa fa-fw fa-' + value.split('||')[1] | trim | default('question-circle') + '"></i> <br/>' %}
|
||||
{% endif %}
|
||||
|
||||
{% if theme.menu_settings.badges %}
|
||||
{% set menuBadge = menu_badge.render(name) | trim %}
|
||||
{% endif %}
|
||||
|
||||
{{ next_url(menuURL, menuIcon + menuText + menuBadge, {rel: 'section'}) }}
|
||||
|
||||
</li>
|
||||
|
||||
{% endmacro %}
|
33
themes/next/layout/_macro/post-collapse.swig
Normal file
33
themes/next/layout/_macro/post-collapse.swig
Normal file
@ -0,0 +1,33 @@
|
||||
{% macro render(post) %}
|
||||
|
||||
<article class="post post-type-{{ post.type | default('normal') }}" itemscope itemtype="http://schema.org/Article">
|
||||
<header class="post-header">
|
||||
|
||||
<{% if theme.seo %}h3{% else %}h2{% endif %} class="post-title">
|
||||
{% if post.link %}{# Link posts #}
|
||||
{% set postTitleIcon = '<i class="fa fa-external-link"></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">
|
||||
{% if post.type === 'picture' %}
|
||||
{{ post.content }}
|
||||
{% else %}
|
||||
<span itemprop="name">{{ post.title | default(__('post.untitled')) }}</span>
|
||||
{% endif %}
|
||||
</a>
|
||||
{% endif %}
|
||||
</{% if theme.seo %}h3{% else %}h2{% endif %}>
|
||||
|
||||
<div class="post-meta">
|
||||
<time class="post-time" itemprop="dateCreated"
|
||||
datetime="{{ moment(post.date).format() }}"
|
||||
content="{{ date(post.date, config.date_format) }}">
|
||||
{{ date(post.date, 'MM-DD') }}
|
||||
</time>
|
||||
</div>
|
||||
|
||||
</header>
|
||||
</article>
|
||||
|
||||
{% endmacro %}
|
460
themes/next/layout/_macro/post.swig
Normal file
460
themes/next/layout/_macro/post.swig
Normal file
@ -0,0 +1,460 @@
|
||||
{% macro render(post, is_index, post_extra_class) %}
|
||||
|
||||
{% set headlessPost = Array.prototype.indexOf.call(['quote', 'picture'], post.type) > -1 %}
|
||||
|
||||
{% set post_class = 'post post-type-' + post.type | default('normal') %}
|
||||
{% if post_extra_class > 0 %}
|
||||
{% set post_class = post_class + ' ' + post_extra_class | default('') %}
|
||||
{% endif %}
|
||||
{% if post.sticky > 0 %}
|
||||
{% set post_class = post_class + ' post-sticky' %}
|
||||
{% endif %}
|
||||
|
||||
{% if theme.reading_progress.enable && not is_index %}
|
||||
<div class="reading-progress-bar"></div>
|
||||
{% endif %}
|
||||
|
||||
<article class="{{ post_class }}" itemscope itemtype="http://schema.org/Article">
|
||||
{##################}
|
||||
{### POST BLOCK ###}
|
||||
{##################}
|
||||
<div class="post-block">
|
||||
<link itemprop="mainEntityOfPage" href="{{ config.url }}{{ url_for(post.path) }}"/>
|
||||
|
||||
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
|
||||
<meta itemprop="name" content="{{ author }}"/>
|
||||
<meta itemprop="description" content="{{ description }}"/>
|
||||
<meta itemprop="image" content="{{ url_for( theme.avatar.url | default(theme.images + '/avatar.gif') ) }}"/>
|
||||
</span>
|
||||
|
||||
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
|
||||
<meta itemprop="name" content="{{ title }}"/>
|
||||
</span>
|
||||
|
||||
{% if not headlessPost %}
|
||||
<header class="post-header">
|
||||
|
||||
{# Not to show title for quote posts that do not have a title #}
|
||||
{% if not (is_index and post.type === 'quote' and not post.title) %}
|
||||
<{% if theme.seo %}h2{% else %}h1{% endif %} class="post-title{% if post.direction && post.direction.toLowerCase() === 'rtl' %} rtl{% endif %}" itemprop="name headline">{#
|
||||
#}{# Link posts #}{#
|
||||
#}{% if post.link %}
|
||||
{% if post.sticky > 0 %}
|
||||
{{ post.sticky }}
|
||||
<span class="post-sticky-flag" title="{{ __('post.sticky') }}">
|
||||
<i class="fa fa-thumb-tack"></i>
|
||||
</span>
|
||||
{% endif %}
|
||||
{% set postTitleIcon = '<i class="fa fa-external-link"></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 %}{#
|
||||
#}{% if is_index %}
|
||||
{% if post.sticky > 0 %}
|
||||
<span class="post-sticky-flag" title="{{ __('post.sticky') }}">
|
||||
<i class="fa fa-thumb-tack"></i>
|
||||
</span>
|
||||
{% endif %}
|
||||
{# Need to delete maybe? #}
|
||||
{{ next_url(post.path, post.title | default(__('post.untitled')), {class: 'post-title-link', itemprop: 'url' }) }}
|
||||
{% else -%}
|
||||
{{- post.title -}}
|
||||
{% include '../_partials/post-edit.swig' %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</{% if theme.seo %}h2{% else %}h1{% endif %}>
|
||||
{% endif %}
|
||||
|
||||
<div class="post-meta">
|
||||
<span class="post-time">
|
||||
|
||||
{% 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-icon">
|
||||
<i class="fa fa-calendar-o"></i>
|
||||
</span>
|
||||
{% if theme.post_meta.item_text %}
|
||||
<span class="post-meta-item-text">{{ __('post.posted') }}</span>
|
||||
{% endif %}
|
||||
|
||||
{% if !date_diff && time_diff && theme.post_meta.updated_at.enable && 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>
|
||||
{% endif %}
|
||||
|
||||
{% if theme.post_meta.updated_at.enable && datetime_diff %}
|
||||
{% set display_updated = !theme.post_meta.updated_at.another_day || theme.post_meta.updated_at.another_day && date_diff %}
|
||||
|
||||
{% if display_updated or !theme.post_meta.created_at %}
|
||||
{% if theme.post_meta.created_at and theme.post_meta.updated_at.enable %}
|
||||
<span class="post-meta-divider">|</span>
|
||||
{% endif %}
|
||||
|
||||
<span class="post-meta-item-icon">
|
||||
<i class="fa fa-calendar-check-o"></i>
|
||||
</span>
|
||||
{% if theme.post_meta.item_text %}
|
||||
<span class="post-meta-item-text">{{ __('post.edited') }}</span>
|
||||
{% endif %}
|
||||
<time title="{{ __('post.modified') + __('symbol.colon') + full_date(post.updated) }}" itemprop="dateModified" datetime="{{ moment(post.updated).format() }}">{#
|
||||
#}{{ date(post.updated) -}}
|
||||
</time>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</span>
|
||||
|
||||
{% if post.categories and post.categories.length and theme.post_meta.categories %}
|
||||
<span class="post-category">
|
||||
{% if theme.post_meta.created_at or theme.post_meta.updated_at %}
|
||||
<span class="post-meta-divider">|</span>
|
||||
{% endif %}
|
||||
<span class="post-meta-item-icon">
|
||||
<i class="fa fa-folder-o"></i>
|
||||
</span>
|
||||
{% if theme.post_meta.item_text %}
|
||||
<span class="post-meta-item-text">{{ __('post.in') }}</span>
|
||||
{% endif %}
|
||||
{% for cat in post.categories %}
|
||||
<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 %}
|
||||
|
||||
{% if post.comments %}
|
||||
{% macro comments() %}
|
||||
<span class="post-comments-count">
|
||||
<span class="post-meta-divider">|</span>
|
||||
<span class="post-meta-item-icon">
|
||||
<i class="fa fa-comment-o"></i>
|
||||
</span>
|
||||
{% endmacro %}
|
||||
{% if theme.facebook_comments_plugin.enable %}
|
||||
{{ comments() }}
|
||||
<span class="post-meta-item-text">{{ __('post.comments_count') + __('symbol.colon') }}</span>
|
||||
<a href="{{ url_for(post.path) }}#comments" itemprop="discussionUrl">
|
||||
<span class="post-comments-count fb-comments-count" data-href="{{ post.permalink }}" itemprop="commentCount">0</span>
|
||||
</a>
|
||||
</span>
|
||||
{% elif theme.disqus.enable and theme.disqus.count %}
|
||||
{{ comments() }}
|
||||
<span class="post-meta-item-text">{{ __('post.comments_count') + __('symbol.colon') }}</span>
|
||||
<a href="{{ url_for(post.path) }}#comments" itemprop="discussionUrl">
|
||||
<span class="post-comments-count disqus-comment-count" data-disqus-identifier="{{ post.path }}" itemprop="commentCount"></span>
|
||||
</a>
|
||||
</span>
|
||||
{% elif theme.changyan.enable and theme.changyan.appid and theme.changyan.appkey %}
|
||||
{{ comments() }}
|
||||
{% if is_post() %}
|
||||
<span class="post-meta-item-text">{{ __('post.comments_count') + __('symbol.colon') }}</span>
|
||||
<a href="{{ url_for(post.path) }}#SOHUCS" itemprop="discussionUrl">
|
||||
<span id="changyan_count_unit" class="post-comments-count hc-comment-count" data-xid="{{ post.path }}" itemprop="commentCount"></span>
|
||||
</a>
|
||||
{% else %}
|
||||
<span class="post-meta-item-text">{{ __('post.comments_count') + __('symbol.colon') }}</span>
|
||||
<a href="{{ url_for(post.path) }}#SOHUCS" itemprop="discussionUrl">
|
||||
<span id="url::{{ post.permalink }}" class="cy_cmt_count" data-xid="{{ post.path }}" itemprop="commentCount"></span>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% elif is_post() and theme.gitment.enable and theme.gitment.mint and theme.gitment.count %}
|
||||
{{ comments() }}
|
||||
<span class="post-meta-item-text">{{ __('post.comments_count') + __('symbol.colon') }}</span>
|
||||
<a href="{{ url_for(post.path) }}#comments" itemprop="discussionUrl">
|
||||
<span class="post-comments-count gitment-comments-count" data-xid="{{ url_for(post.path) }}" itemprop="commentCount"></span>
|
||||
</a>
|
||||
</span>
|
||||
{% elif (is_post() or theme.valine.comment_count) and theme.valine.enable and theme.valine.appid and theme.valine.appkey %}
|
||||
{{ comments() }}
|
||||
<span class="post-meta-item-text">{{ __('post.comments_count') + __('symbol.colon') }}</span>
|
||||
<a href="{{ url_for(post.path) }}#comments" itemprop="discussionUrl">
|
||||
<span class="post-comments-count valine-comment-count" data-xid="{{ url_for(post.path) }}" itemprop="commentCount"></span>
|
||||
</a>
|
||||
</span>
|
||||
{% endif %}
|
||||
{% 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="leancloud_visitors" data-flag-title="{{ post.title }}">
|
||||
<span class="post-meta-divider">|</span>
|
||||
<span class="post-meta-item-icon">
|
||||
<i class="fa fa-eye"></i>
|
||||
</span>
|
||||
{% if theme.post_meta.item_text %}
|
||||
<span class="post-meta-item-text">{{ __('post.views') + __('symbol.colon') }}</span>
|
||||
{% endif %}
|
||||
<span class="leancloud-visitors-count"></span>
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
{% if not is_index and theme.busuanzi_count.enable and theme.busuanzi_count.post_views %}
|
||||
<span class="post-meta-divider">|</span>
|
||||
<span class="post-meta-item-icon"
|
||||
{% if not theme.post_meta.item_text %} title="{{ __('post.views') }}" {% endif %}>
|
||||
<i class="fa fa-{{ theme.busuanzi_count.post_views_icon }}"></i>
|
||||
{% if theme.post_meta.item_text %} {{ __('post.views') + __('symbol.colon') }} {% endif %}
|
||||
<span class="busuanzi-value" id="busuanzi_value_page_pv"></span>
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
{% if config.symbols_count_time.symbols or config.symbols_count_time.time %}
|
||||
<div class="post-symbolscount">
|
||||
{% if not theme.symbols_count_time.separated_meta %}
|
||||
<span class="post-meta-divider">|</span>
|
||||
{% endif %}
|
||||
|
||||
{% if config.symbols_count_time.symbols %}
|
||||
<span class="post-meta-item-icon">
|
||||
<i class="fa fa-file-word-o"></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 title="{{ __('symbols_count_time.count') }}">{#
|
||||
#}{{ symbolsCount(post) }}{#
|
||||
#}</span>
|
||||
{% endif %}
|
||||
|
||||
{% if config.symbols_count_time.symbols and config.symbols_count_time.time %}
|
||||
<span class="post-meta-divider">|</span>
|
||||
{% endif %}
|
||||
|
||||
{% if config.symbols_count_time.time %}
|
||||
<span class="post-meta-item-icon">
|
||||
<i class="fa fa-clock-o"></i>
|
||||
</span>
|
||||
{% if theme.symbols_count_time.item_text_post %}
|
||||
<span class="post-meta-item-text">{{ __('symbols_count_time.time') }} ≈</span>
|
||||
{% endif %}
|
||||
<span title="{{ __('symbols_count_time.time') }}">{#
|
||||
#}{{ symbolsTime(post, theme.symbols_count_time.awl, theme.symbols_count_time.wpm, __('symbols_count_time.time_minutes')) }}{#
|
||||
#}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% 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 theme.han %} han-init-context{% endif %}{% if post.direction && 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">
|
||||
{% set COLUMN_NUMBER = 3 %}
|
||||
{% for photo in post.photos %}
|
||||
{% if loop.index0 % COLUMN_NUMBER === 0 %}<div class="post-gallery-row">{% endif %}
|
||||
<img src="{{ url_for(photo) }}" itemprop="contentUrl"/>
|
||||
{% if loop.index0 % COLUMN_NUMBER === 2 %}</div>{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{# Append end tag for `post-gallery-row` when (photos size mod COLUMN_NUMBER) is less than COLUMN_NUMBER #}
|
||||
{% if post.photos.length % COLUMN_NUMBER > 0 %}</div>{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if is_index %}
|
||||
{% if post.description and theme.excerpt_description %}
|
||||
{{ post.description }}
|
||||
<!--noindex-->
|
||||
{% if theme.read_more_btn %}
|
||||
<div class="post-button text-center">
|
||||
<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 text-center">
|
||||
<a class="btn" href="{{ url_for(post.path) }}{% if theme.scroll_to_more %}#more{% endif %}" rel="contents">
|
||||
{{ __('post.read_more') }} »
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
<!--/noindex-->
|
||||
{% elif theme.auto_excerpt.enable %}
|
||||
{% set content = post.content | replace('<td class="gutter">.*?</td>', "", "g") | striptags %}
|
||||
<p>
|
||||
{{ content.substring(0, theme.auto_excerpt.length) }}
|
||||
{% if content.length > theme.auto_excerpt.length %}...{% endif %}
|
||||
</p>
|
||||
<!--noindex-->
|
||||
{% if theme.read_more_btn %}
|
||||
<div class="post-button text-center">
|
||||
<a class="btn" href="{{ url_for(post.path) }}{% if theme.scroll_to_more %}#more{% endif %}" rel="contents">
|
||||
{{ __('post.read_more') }} »
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
<!--/noindex-->
|
||||
{% else %}
|
||||
{% if post.type === 'picture' %}
|
||||
<a href="{{ url_for(post.path) }}">{{ post.content }}</a>
|
||||
{% else %}
|
||||
{{ post.content }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{{ post.content }}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if theme.related_posts.enable and (theme.related_posts.display_in_home or not is_index) %}
|
||||
{% include '../_partials/post/post-related.swig' with { post: post } %}
|
||||
{% endif %}
|
||||
|
||||
{#####################}
|
||||
{### END POST BODY ###}
|
||||
{#####################}
|
||||
|
||||
{% if theme.wechat_subscriber.enable and not is_index %}
|
||||
{% include '../_partials/post/wechat-subscriber.swig' %}
|
||||
{% endif %}
|
||||
|
||||
{% if page.reward === undefined and theme.reward_settings.enable %}
|
||||
{% set reward_able = true %}
|
||||
{% else %}
|
||||
{% set reward_able = page.reward %}
|
||||
{% endif %}
|
||||
{% if reward_able and not is_index %}
|
||||
<div>
|
||||
{% include '../_partials/post/reward.swig' %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if theme.creative_commons.license and theme.creative_commons.post and not is_index %}
|
||||
<div>
|
||||
{% include '../_partials/post/post-copyright.swig' with { post: post } %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<footer class="post-footer">
|
||||
{% if post.tags and post.tags.length and not is_index %}
|
||||
<div class="post-tags">
|
||||
{% for tag in post.tags %}
|
||||
<a href="{{ url_for(tag.path) }}" rel="tag"># {{ tag.name }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if not is_index %}
|
||||
{% if theme.rating.enable or (theme.vkontakte_api.enable and theme.vkontakte_api.like) or (theme.facebook_sdk.enable and theme.facebook_sdk.like_button) or theme.likely.enable or (theme.needmoreshare2.enable and theme.needmoreshare2.postbottom.enable) or (theme.baidushare and theme.baidushare.type === "button") %}
|
||||
<div class="post-widgets">
|
||||
{% if theme.rating.enable %}
|
||||
<div class="wp_rating">
|
||||
<div id="wpac-rating"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if (theme.vkontakte_api.enable and theme.vkontakte_api.like) or (theme.facebook_sdk.enable and theme.facebook_sdk.like_button) %}
|
||||
{% if theme.rating.enable %}
|
||||
<span class="post-meta-divider">|</span>
|
||||
{% endif %}
|
||||
<div class="social-like">
|
||||
{% if theme.vkontakte_api.enable and theme.vkontakte_api.like %}
|
||||
<div class="vk_like">
|
||||
<span id="vk_like"></span>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if theme.facebook_sdk.enable and theme.facebook_sdk.like_button %}
|
||||
<div class="fb_like">
|
||||
<div class="fb-like" data-layout="button_count" data-share="true"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if theme.likely.enable or (theme.needmoreshare2.enable and theme.needmoreshare2.postbottom.enable) or (theme.baidushare.type === "button") %}
|
||||
{% if theme.rating.enable or (theme.vkontakte_api.enable and theme.vkontakte_api.like) or (theme.facebook_sdk.enable and theme.facebook_sdk.like_button) %}
|
||||
<span class="post-meta-divider">|</span>
|
||||
{% endif %}
|
||||
<div class="social_share">
|
||||
{% if theme.likely.enable %}
|
||||
<div>
|
||||
{% include '../_partials/share/likely.swig' %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if theme.needmoreshare2.enable and theme.needmoreshare2.postbottom.enable %}
|
||||
<div id="needsharebutton-postbottom">
|
||||
<span class="btn">
|
||||
<i class="fa fa-share-alt" aria-hidden="true"></i>
|
||||
</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if theme.baidushare.type === "button" %}
|
||||
<div>
|
||||
{% include '../_partials/share/baidushare.swig' %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if not is_index and (post.prev or post.next) %}
|
||||
<div class="post-nav">
|
||||
<div class="post-nav-next post-nav-item">
|
||||
{% if post.next %}
|
||||
<a href="{{ url_for(post.next.path) }}" rel="next" title="{{ post.next.title }}">
|
||||
<i class="fa fa-chevron-left"></i> {{ post.next.title }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<span class="post-nav-divider"></span>
|
||||
|
||||
<div class="post-nav-prev post-nav-item">
|
||||
{% if post.prev %}
|
||||
<a href="{{ url_for(post.prev.path) }}" rel="prev" title="{{ post.prev.title }}">
|
||||
{{ post.prev.title }} <i class="fa fa-chevron-right"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% set isLast = loop.index % page.per_page === 0 %}
|
||||
{% if is_index and not isLast %}
|
||||
<div class="post-eof"></div>
|
||||
{% endif %}
|
||||
</footer>
|
||||
</div>
|
||||
{######################}
|
||||
{### END POST BLOCK ###}
|
||||
{######################}
|
||||
</article>
|
||||
|
||||
{% endmacro %}
|
214
themes/next/layout/_macro/sidebar.swig
Normal file
214
themes/next/layout/_macro/sidebar.swig
Normal file
@ -0,0 +1,214 @@
|
||||
{% macro render(is_post) %}
|
||||
<div class="sidebar-toggle">
|
||||
<div class="sidebar-toggle-line-wrap">
|
||||
<span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
|
||||
<span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
|
||||
<span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<aside id="sidebar" class="sidebar">
|
||||
<div class="sidebar-inner">
|
||||
|
||||
{% set display_toc = is_post and theme.toc.enable or is_page and theme.toc.enable %}
|
||||
|
||||
{% if display_toc and toc(page.content).length > 1 %}
|
||||
<ul class="sidebar-nav motion-element">
|
||||
<li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
|
||||
{{ __('sidebar.toc') }}
|
||||
</li>
|
||||
<li class="sidebar-nav-overview" data-target="site-overview-wrap">
|
||||
{{ __('sidebar.overview') }}
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
<div class="site-overview-wrap sidebar-panel{% if not display_toc or toc(page.content).length <= 1 %} sidebar-panel-active{% endif %}">
|
||||
<div class="site-overview">
|
||||
<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"
|
||||
src="{{ url_for( theme.avatar.url | default(theme.images + '/avatar.gif') ) }}"
|
||||
alt="{{ author }}"/>
|
||||
{% endif %}
|
||||
<p class="site-author-name" itemprop="name">{{ author }}</p>
|
||||
<div class="site-description motion-element" itemprop="description">{{ description }}</div>
|
||||
</div>
|
||||
|
||||
{% if theme.site_state %}
|
||||
<nav class="site-state motion-element">
|
||||
{% 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 %}
|
||||
{% set visibleCategories = 0 %}
|
||||
{% for cat in site.categories %}
|
||||
{% if cat.length %}{% set visibleCategories += 1 %}{% endif %}
|
||||
{% endfor %}
|
||||
<span class="site-state-item-count">{{ visibleCategories }}</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 %}
|
||||
{% set visibleTags = 0 %}
|
||||
{% for tag in site.tags %}
|
||||
{% if tag.length %}{% set visibleTags += 1 %}{% endif %}
|
||||
{% endfor %}
|
||||
<span class="site-state-item-count">{{ visibleTags }}</span>
|
||||
<span class="site-state-item-name">{{ __('state.tags') }}</span>
|
||||
{% if hasTagsPage %}</a>{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</nav>
|
||||
{% endif %}
|
||||
|
||||
{% if theme.rss %}
|
||||
<div class="feed-link motion-element">
|
||||
<a href="{{ url_for(theme.rss) }}" rel="alternate">
|
||||
<i class="fa fa-rss"></i>
|
||||
RSS
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if theme.chat.enable and theme.chat.service !== '' %}
|
||||
<div class="chat 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="fa fa-{{ 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 not (theme.social_icons.enable) or (not theme.social_icons.icons_only) %}
|
||||
{% set sidebarText = name %}
|
||||
{% endif %}
|
||||
{% if theme.social_icons.enable %}
|
||||
{% set sidebarIcon = '<i class="fa fa-fw fa-' + link.split('||')[1] | trim | default('globe') + '"></i>' %}
|
||||
{% 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 ccLanguage = theme.creative_commons.language %}
|
||||
{% if theme.creative_commons.license === 'zero' %}
|
||||
{% set ccType = 'publicdomain/zero/1.0/' + ccLanguage %}
|
||||
{% else %}
|
||||
{% set ccType = 'licenses/' + theme.creative_commons.license + '/4.0/' + ccLanguage %}
|
||||
{% endif %}
|
||||
{% set ccURL = 'https://creativecommons.org/' + ccType %}
|
||||
{% 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 {{ "links-of-blogroll-" + theme.links_layout | default('inline') }}">
|
||||
<div class="links-of-blogroll-title">
|
||||
<i class="fa fa-fw fa-{{ theme.links_icon | default('globe') | lower }}"></i>
|
||||
{{ theme.links_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 %}
|
||||
|
||||
{% if theme.custom_file_path.sidebar %}
|
||||
{% set custom_sidebar = '../../../../' + theme.custom_file_path.sidebar %}
|
||||
{% else %}
|
||||
{% set custom_sidebar = '../_custom/sidebar.swig' %}
|
||||
{% endif %}
|
||||
{% include custom_sidebar %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if display_toc and toc(page.content).length > 1 %}
|
||||
<!--noindex-->
|
||||
<div class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
|
||||
<div class="post-toc">
|
||||
|
||||
{% set next_toc_number = theme.toc.number %}
|
||||
{% if page.toc_number !== undefined %}
|
||||
{% set next_toc_number = page.toc_number %}
|
||||
{% endif %}
|
||||
{% set next_toc_max_depth = page.toc_max_depth|default(theme.toc.max_depth)|default(6) %}
|
||||
{% set toc = toc(page.content, { "class": "nav", list_number: next_toc_number, max_depth: next_toc_max_depth }) %}
|
||||
|
||||
{% if toc.length <= 1 %}
|
||||
<p class="post-toc-empty">{{ __('post.toc_empty') }}</p>
|
||||
{% else %}
|
||||
<div class="post-toc-content">{{ toc }}</div>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!--/noindex-->
|
||||
{% endif %}
|
||||
|
||||
{% if theme.back2top.enable and theme.back2top.sidebar %}
|
||||
<div class="back-to-top">
|
||||
<i class="fa fa-arrow-up"></i>
|
||||
{% if theme.back2top.scrollpercent %}
|
||||
<span id="scrollpercent"><span>0</span>%</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</aside>
|
||||
{% if theme.sidebar.dimmer %}
|
||||
<div id="sidebar-dimmer"></div>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
57
themes/next/layout/_partials/comments.swig
Normal file
57
themes/next/layout/_partials/comments.swig
Normal file
@ -0,0 +1,57 @@
|
||||
{% if page.comments %}
|
||||
|
||||
{% if theme.facebook_sdk.enable and theme.facebook_comments_plugin.enable %}
|
||||
<div class="comments" id="comments">
|
||||
<div class="fb-comments"
|
||||
data-href="{{ page.permalink }}"
|
||||
data-numposts="{{ theme.facebook_comments_plugin.num_of_posts }}"
|
||||
data-width="{{ theme.facebook_comments_plugin.width }}"
|
||||
data-colorscheme="{{ theme.facebook_comments_plugin.scheme }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% elif theme.vkontakte_api.enable and theme.vkontakte_api.comments %}
|
||||
<div class="comments" id="comments">
|
||||
<div id="vk_comments"></div>
|
||||
</div>
|
||||
|
||||
{% elif theme.disqus.enable or (theme.disqusjs.enable and theme.disqusjs.apikey and theme.disqusjs.shortname) %}
|
||||
<div class="comments" id="comments">
|
||||
<div id="disqus_thread">
|
||||
<noscript>{#
|
||||
#}Please enable JavaScript to view the comments powered by Disqus.{#
|
||||
#}</noscript>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% elif theme.livere_uid %}
|
||||
<div class="comments" id="comments">
|
||||
<div id="lv-container" data-id="city" data-uid="{{ theme.livere_uid }}"></div>
|
||||
</div>
|
||||
|
||||
{% elif theme.changyan.enable and theme.changyan.appid and theme.changyan.appkey %}
|
||||
<div class="comments" id="comments">
|
||||
<div id="SOHUCS"></div>
|
||||
</div>
|
||||
|
||||
{% elif theme.gitment.enable %}
|
||||
<div class="comments" id="comments">
|
||||
{% if theme.gitment.lazy %}
|
||||
<div onclick="showGitment()" id="gitment-display-button">{{ __('gitmentbutton') }}</div>
|
||||
<div id="gitment-container" style="display: none"></div>
|
||||
{% else %}
|
||||
<div id="gitment-container"></div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% elif theme.valine.enable and theme.valine.appid and theme.valine.appkey %}
|
||||
<div class="comments" id="comments">
|
||||
</div>
|
||||
|
||||
{% elif theme.gitalk.enable %}
|
||||
<div class="comments" id="gitalk-container">
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
62
themes/next/layout/_partials/footer.swig
Normal file
62
themes/next/layout/_partials/footer.swig
Normal file
@ -0,0 +1,62 @@
|
||||
<div class="copyright">{#
|
||||
#}{% set current = date(Date.now(), "YYYY") %}{#
|
||||
#}{% if theme.footer.beian.enable %}{#
|
||||
#} {{ next_url('http://www.beian.miit.gov.cn', theme.footer.beian.icp + ' ') }}{#
|
||||
#}{% endif %}{#
|
||||
#}© {% if theme.footer.since and theme.footer.since != current %}{{ theme.footer.since }} – {% endif %}{#
|
||||
#}<span itemprop="copyrightYear">{{ current }}</span>
|
||||
<span class="with-love" id="animate">
|
||||
<i class="fa fa-{{ theme.footer.icon.name }}"></i>
|
||||
</span>
|
||||
<span class="author" itemprop="copyrightHolder">{{ theme.footer.copyright || 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-area-chart"></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, theme.symbols_count_time.awl, theme.symbols_count_time.wpm, __('symbols_count_time.time_minutes')) }}{#
|
||||
#}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if theme.footer.powered.enable %}
|
||||
<div class="powered-by">{#
|
||||
#}{{ __('footer.powered', next_url('https://hexo.io', 'Hexo', {class: 'theme-link'})) }}{#
|
||||
#}{% if theme.footer.powered.version %} v{{ hexo_env('version') }}{% endif %}{#
|
||||
#}</div>
|
||||
{% endif %}
|
||||
|
||||
{% if theme.footer.powered.enable and theme.footer.theme.enable %}
|
||||
<span class="post-meta-divider">|</span>
|
||||
{% endif %}
|
||||
|
||||
{% if theme.footer.theme.enable %}
|
||||
<div class="theme-info">{#
|
||||
#}{{ __('footer.theme') }} – {{ next_url('https://theme-next.org', 'NexT.' + theme.scheme, {class: 'theme-link'}) }}{#
|
||||
#}{% if theme.footer.theme.version %} v{{ version }}{% endif %}{#
|
||||
#}</div>
|
||||
{% endif %}
|
||||
|
||||
{% if theme.footer.custom_text %}
|
||||
<div class="footer-custom">{#
|
||||
#}{{ theme.footer.custom_text }}{#
|
||||
#}</div>
|
||||
{% endif %}
|
8
themes/next/layout/_partials/github-banner.swig
Normal file
8
themes/next/layout/_partials/github-banner.swig
Normal file
@ -0,0 +1,8 @@
|
||||
{% 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 %}
|
51
themes/next/layout/_partials/head/external-fonts.swig
Normal file
51
themes/next/layout/_partials/head/external-fonts.swig
Normal file
@ -0,0 +1,51 @@
|
||||
{% if theme.font.enable %}
|
||||
|
||||
{% set font_config = theme.font %}
|
||||
{% set font_families = '' %}
|
||||
{% set font_styles = ':300,300italic,400,400italic,700,700italic' %}
|
||||
{% set font_found = false %}
|
||||
|
||||
{% if font_config.global.family and font_config.global.external %}
|
||||
{% set font_families += font_config.global.family + font_styles %}
|
||||
{% set font_found = true %}
|
||||
{% endif %}
|
||||
|
||||
{% if font_config.headings.family and font_config.headings.external %}
|
||||
{% if font_found %}
|
||||
{% set font_families += '|' %}
|
||||
{% endif %}
|
||||
|
||||
{% set font_families += font_config.headings.family + font_styles %}
|
||||
{% endif %}
|
||||
|
||||
{% if font_config.posts.family and font_config.posts.external %}
|
||||
{% if font_found %}
|
||||
{% set font_families += '|' %}
|
||||
{% endif %}
|
||||
|
||||
{% set font_families += font_config.posts.family + font_styles %}
|
||||
{% endif %}
|
||||
|
||||
{% if font_config.logo.family and font_config.logo.external %}
|
||||
{% if font_found %}
|
||||
{% set font_families += '|' %}
|
||||
{% endif %}
|
||||
|
||||
{% set font_families += font_config.logo.family + font_styles %}
|
||||
{% endif %}
|
||||
|
||||
{% if font_config.codes.family and font_config.codes.external %}
|
||||
{% if font_found %}
|
||||
{% set font_families += '|' %}
|
||||
{% endif %}
|
||||
|
||||
{% set font_families += font_config.codes.family + font_styles %}
|
||||
{% endif %}
|
||||
|
||||
{% if font_families !== '' %}
|
||||
{% set font_families += '&subset=latin,latin-ext' %}
|
||||
{% set font_host = font_config.host | default('//fonts.googleapis.com') %}
|
||||
<link rel="stylesheet" href="{{ font_host }}/css?family={{ font_families }}"/>
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
28
themes/next/layout/_partials/head/head-unique.swig
Normal file
28
themes/next/layout/_partials/head/head-unique.swig
Normal file
@ -0,0 +1,28 @@
|
||||
{{
|
||||
open_graph({
|
||||
twitter_id: theme.twitter,
|
||||
google_plus: theme.google_plus,
|
||||
fb_admins: theme.fb_admins,
|
||||
fb_app_id: theme.fb_app_id
|
||||
})
|
||||
}}
|
||||
|
||||
{% if theme.rss === '' and config.feed and config.feed.path %}
|
||||
{% set theme.rss = config.feed.path %}
|
||||
{% endif %}
|
||||
{% if theme.rss %}
|
||||
<link rel="alternate" href="{{ url_for(theme.rss) }}" title="{{ title }}" type="application/atom+xml"/>
|
||||
{% endif %}
|
||||
|
||||
{% if theme.canonical %}
|
||||
{% set without_index = url.replace('index.html', '') %}
|
||||
{% set without_html = without_index.replace('.html', '') %}
|
||||
<link rel="canonical" href="{{ without_html }}"/>
|
||||
{% endif %}
|
||||
|
||||
{# Exports some front-matter variables to Front-End #}
|
||||
<script id="page.configurations">
|
||||
CONFIG.page = {
|
||||
sidebar: {{ page.sidebar | json_encode }},
|
||||
};
|
||||
</script>
|
128
themes/next/layout/_partials/head/head.swig
Normal file
128
themes/next/layout/_partials/head/head.swig
Normal file
@ -0,0 +1,128 @@
|
||||
<meta charset="UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2"/>
|
||||
<meta name="theme-color" content="{{ theme.android_chrome_color }}"/>
|
||||
|
||||
{% if theme.needmoreshare2.enable %}
|
||||
{% set needmoreshare2_css = url_for(theme.vendors._internal + '/needsharebutton/needsharebutton.css') %}
|
||||
{% if theme.vendors.needmoreshare2_css %}
|
||||
{% set needmoreshare2_css = theme.vendors.needmoreshare2_css %}
|
||||
{% endif %}
|
||||
<link rel="stylesheet" href="{{ needmoreshare2_css }}"/>
|
||||
{% endif %}
|
||||
|
||||
{% if theme.pace %}
|
||||
{% set pace_css_uri = url_for(theme.vendors._internal + '/pace/'+ theme.pace_theme +'.min.css?v=1.0.2') %}
|
||||
{% set pace_js_uri = url_for(theme.vendors._internal + '/pace/pace.min.js?v=1.0.2') %}
|
||||
{% if theme.vendors.pace %}
|
||||
{% set pace_js_uri = theme.vendors.pace %}
|
||||
{% endif %}
|
||||
{% if theme.vendors.pace_css %}
|
||||
{% set pace_css_uri = theme.vendors.pace_css %}
|
||||
{% endif %}
|
||||
<script src="{{ pace_js_uri }}"></script>
|
||||
<link rel="stylesheet" href="{{ pace_css_uri }}"/>
|
||||
{% endif %}
|
||||
|
||||
{% if theme.han %}
|
||||
{% set Han_uri = url_for(theme.vendors._internal + '/Han/dist/han.min.css?v=3.3') %}
|
||||
{% if theme.vendors.han %}
|
||||
{% set Han_uri = theme.vendors.han %}
|
||||
{% endif %}
|
||||
<link rel="stylesheet" href="{{ Han_uri }}"/>
|
||||
{% 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 %}
|
||||
|
||||
{% if theme.fancybox %}
|
||||
{% set fancybox_css_uri = url_for(theme.vendors._internal + '/fancybox/source/jquery.fancybox.css') %}
|
||||
{% if theme.vendors.fancybox_css %}
|
||||
{% set fancybox_css_uri = theme.vendors.fancybox_css %}
|
||||
{% endif %}
|
||||
<link rel="stylesheet" href="{{ fancybox_css_uri }}"/>
|
||||
{% endif %}
|
||||
|
||||
{% include "./external-fonts.swig" %}
|
||||
|
||||
{% set font_awesome_uri = url_for(theme.vendors._internal + '/font-awesome/css/font-awesome.min.css?v=4.6.2') %}
|
||||
{% if theme.vendors.fontawesome %}
|
||||
{% set font_awesome_uri = theme.vendors.fontawesome %}
|
||||
{% endif %}
|
||||
<link rel="stylesheet" href="{{ font_awesome_uri }}"/>
|
||||
|
||||
<link rel="stylesheet" href="{{ url_for(theme.css) }}/main.css?v={{ version }}"/>
|
||||
|
||||
{% if theme.favicon.apple_touch_icon %}
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="{{ url_for(theme.favicon.apple_touch_icon) }}?v={{ version }}">
|
||||
{% endif %}
|
||||
{% if theme.favicon.medium %}
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="{{ url_for(theme.favicon.medium) }}?v={{ version }}">
|
||||
{% endif %}
|
||||
{% if theme.favicon.small %}
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="{{ url_for(theme.favicon.small) }}?v={{ version }}">
|
||||
{% endif %}
|
||||
{% if theme.favicon.safari_pinned_tab %}
|
||||
<link rel="mask-icon" href="{{ url_for(theme.favicon.safari_pinned_tab) }}?v={{ version }}" 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.facebook_sdk.enable and theme.facebook_sdk.webmaster %}
|
||||
<meta property="fb:admins" content="{{ theme.facebook_sdk.fb_admin }}"/>
|
||||
<meta property="fb:app_id" content="{{ theme.facebook_sdk.app_id }}"/>
|
||||
{% endif %}
|
||||
|
||||
{# Export some HEXO Configurations to Front-End #}
|
||||
<script id="hexo.configurations">
|
||||
var NexT = window.NexT || {};
|
||||
var CONFIG = {
|
||||
root: '{{ theme.root }}',
|
||||
scheme: '{{ theme.scheme }}',
|
||||
version: '{{ version }}',
|
||||
sidebar: {{ theme.sidebar | json_encode }},
|
||||
back2top: {{ theme.back2top.enable }},
|
||||
back2top_sidebar: {{ theme.back2top.sidebar }},
|
||||
fancybox: {{ theme.fancybox }},
|
||||
fastclick: {{ theme.fastclick }},
|
||||
lazyload: {{ theme.lazyload }},
|
||||
tabs: {{ theme.tabs.enable }},
|
||||
motion: {{ theme.motion | json_encode }},
|
||||
algolia: {
|
||||
applicationID: '{{ theme.algolia.applicationID }}',
|
||||
apiKey: '{{ theme.algolia.apiKey }}',
|
||||
indexName: '{{ theme.algolia.indexName }}',
|
||||
hits: {{ theme.algolia_search.hits | json_encode }},
|
||||
labels: {{ theme.algolia_search.labels | json_encode }}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
{% if theme.custom_file_path.head %}
|
||||
{% set custom_head = '../../../../../' + theme.custom_file_path.head %}
|
||||
{% else %}
|
||||
{% set custom_head = '../../_custom/head.swig' %}
|
||||
{% endif %}
|
||||
{% include custom_head %}
|
39
themes/next/layout/_partials/header/brand.swig
Normal file
39
themes/next/layout/_partials/header/brand.swig
Normal file
@ -0,0 +1,39 @@
|
||||
<div class="site-brand-wrapper">
|
||||
<div class="site-meta{% if theme.custom_logo.enable %} custom-logo{% endif %}">
|
||||
{% if theme.custom_logo.enable and theme.custom_logo.image and theme.scheme === 'Muse' %}
|
||||
<div class="site-meta-headline">
|
||||
<a>
|
||||
<img class="custom-logo-image" src="{{ theme.custom_logo.image }}" alt="{{ title }}"/>
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="custom-logo-site-title">
|
||||
<a href="{{ config.root }}" class="brand" rel="start">
|
||||
<span class="logo-line-before"><i></i></span>
|
||||
<span class="site-title">{{ title }}</span>
|
||||
<span class="logo-line-after"><i></i></span>
|
||||
</a>
|
||||
</div>
|
||||
{% if subtitle %}
|
||||
{% if theme.seo %}
|
||||
<h1 class="site-subtitle" itemprop="description">{{ subtitle }}</h1>
|
||||
{% else %}
|
||||
<p class="site-subtitle">{{ subtitle }}</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if theme.custom_logo.enable and theme.custom_logo.image and (theme.scheme === 'Gemini' or theme.scheme === 'Pisces') %}
|
||||
<a>
|
||||
<img class="custom-logo-image" src="{{ theme.custom_logo.image }}" alt="{{ title }}"/>
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="site-nav-toggle">
|
||||
<button aria-label="{{ __('accessibility.nav_toggle') }}">
|
||||
<span class="btn-bar"></span>
|
||||
<span class="btn-bar"></span>
|
||||
<span class="btn-bar"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
9
themes/next/layout/_partials/header/index.swig
Normal file
9
themes/next/layout/_partials/header/index.swig
Normal file
@ -0,0 +1,9 @@
|
||||
{{ partial('_partials/header/brand.swig', {}, {cache: theme.cache.enable}) }}
|
||||
{% include 'menu.swig' %}
|
||||
|
||||
{% if theme.custom_file_path.header %}
|
||||
{% set custom_header = '../../../../../' + theme.custom_file_path.header %}
|
||||
{% else %}
|
||||
{% set custom_header = '../../_custom/header.swig' %}
|
||||
{% endif %}
|
||||
{% include custom_header %}
|
52
themes/next/layout/_partials/header/menu.swig
Normal file
52
themes/next/layout/_partials/header/menu.swig
Normal file
@ -0,0 +1,52 @@
|
||||
{% import '../../_macro/menu/menu-item.swig' as menu_item %}
|
||||
|
||||
<nav class="site-nav">
|
||||
{% if theme.menu %}
|
||||
<ul id="menu" class="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.toLowerCase() %}
|
||||
{% set respath = subpath %}
|
||||
{% if itemName == 'default' %}
|
||||
{% set itemName = name.toLowerCase() %}
|
||||
{{ menu_item.render(name, respath) }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{# Main Menu (standart menu items) #}
|
||||
{% set itemName = name.toLowerCase() %}
|
||||
{{- menu_item.render(name, respath) | trim -}}
|
||||
{%- endif -%}
|
||||
{%- endfor %}
|
||||
|
||||
{% set hasSearch = theme.swiftype_key || theme.algolia_search.enable || theme.local_search.enable %}
|
||||
{% if hasSearch %}
|
||||
<li class="menu-item menu-item-search">
|
||||
{% if theme.swiftype_key %}
|
||||
<a href="javascript:;" class="st-search-show-outputs">
|
||||
{% elif theme.local_search.enable || theme.algolia_search.enable %}
|
||||
<a href="javascript:;" class="popup-trigger">
|
||||
{% endif %}
|
||||
{% if theme.menu_settings.icons %}
|
||||
<i class="menu-item-icon fa fa-search fa-fw"></i> <br/>{#
|
||||
#}{% endif %}{#
|
||||
#}{{ __('menu.search') }}{#
|
||||
#}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% if theme.scheme === 'Muse' || theme.scheme === 'Mist' %}
|
||||
{% include 'sub-menu.swig' %}
|
||||
{% endif %}
|
||||
|
||||
{% if hasSearch %}
|
||||
<div class="site-search">
|
||||
{% include '../search/index.swig' %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</nav>
|
100
themes/next/layout/_partials/header/sub-menu.swig
Normal file
100
themes/next/layout/_partials/header/sub-menu.swig
Normal file
@ -0,0 +1,100 @@
|
||||
{% if not is_home() && not is_post() %}
|
||||
{% if theme.menu %}
|
||||
|
||||
{% import '../../_macro/menu/menu-item.swig' as menu_item %}
|
||||
|
||||
{# 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('/', '', 'g') %}
|
||||
|
||||
{# 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.toLowerCase() %}
|
||||
{% if itemName == 'default' %}
|
||||
{% set parentValue = subvalue.split('||')[0] | trim %}
|
||||
{% else %}
|
||||
{% if subvalue.indexOf('http') == 0 %}
|
||||
{% set respath = subvalue %}
|
||||
{% else %}
|
||||
{% set respath = parentValue + subvalue %}
|
||||
{% endif %}
|
||||
{{ menu_item.render(subname, respath) }}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{# For 'default' submenu item in main submenu #}
|
||||
{% set itemName = subname.toLowerCase() %}
|
||||
{% for subname2, subvalue2 in subvalue %}
|
||||
{% if subname2 == 'default' %}
|
||||
{% set respath = parentValue + subvalue2 %}
|
||||
{{ menu_item.render(subname, 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.toLowerCase() %}
|
||||
{% 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('/', '', 'g') %}
|
||||
|
||||
{# Submenu-2 items #}
|
||||
<ul id="sub-menu-2" class="sub-menu menu">
|
||||
{% for subname2, subvalue2 in subvalue %}
|
||||
{% set respath2 = subvalue %}
|
||||
{% set itemName = subname2.toLowerCase() %}
|
||||
{% if itemName == 'default' %}
|
||||
{% set parentSubValue = subvalue2.split('||')[0] | trim %}
|
||||
{% else %}
|
||||
{% if subvalue2.indexOf('http') == 0 %}
|
||||
{% set respath2 = subvalue2 %}
|
||||
{% else %}
|
||||
{% set respath2 = parentValue + parentSubValue + subvalue2 %}
|
||||
{% endif %}
|
||||
{{ menu_item.render(subname2, 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 %}
|
||||
{% 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 += 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 += '/' + path %}
|
||||
{% endif %}
|
||||
{% if path.indexOf('.html') == -1 %}
|
||||
<li><a href="{{ url_for(link) }}/">{{ path | upper }}</a></li>
|
||||
{% else %}
|
||||
<li>{{ path.replace('.html', '') | upper }}</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">
|
||||
|
||||
<{% if theme.seo %}h2{% else %}h1{% endif %} class="post-title" itemprop="name headline">
|
||||
{{- page.title -}}
|
||||
{% include '../post-edit.swig' %}
|
||||
</{% if theme.seo %}h2{% else %}h1{% endif %}>
|
||||
|
||||
<div class="post-meta">
|
||||
{% if page.description %}
|
||||
<div class="post-description">{{ page.description }}</div>
|
||||
{% endif %}
|
||||
{% include 'breadcrumb.swig' %}
|
||||
</div>
|
||||
|
||||
</header>
|
11
themes/next/layout/_partials/pagination.swig
Normal file
11
themes/next/layout/_partials/pagination.swig
Normal file
@ -0,0 +1,11 @@
|
||||
{% 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
|
||||
})
|
||||
}}
|
||||
</nav>
|
||||
{% endif %}
|
4
themes/next/layout/_partials/post-edit.swig
Normal file
4
themes/next/layout/_partials/post-edit.swig
Normal file
@ -0,0 +1,4 @@
|
||||
{% if theme.post_edit.enable -%}
|
||||
{% set editIcon = '<i class="fa fa-pencil"></i>' -%}
|
||||
{{ next_url(theme.post_edit.url + page.source, editIcon, {class: 'post-edit-link', title: __('post.edit') }) }}
|
||||
{%- endif %}
|
26
themes/next/layout/_partials/post/post-copyright.swig
Normal file
26
themes/next/layout/_partials/post/post-copyright.swig
Normal file
@ -0,0 +1,26 @@
|
||||
{% set ccLicense = theme.creative_commons.license | lower %}
|
||||
{% set ccLanguage = theme.creative_commons.language %}
|
||||
{% set ccIcon = '<i class="fa fa-fw fa-creative-commons"></i>' %}
|
||||
{% set ccText = ccLicense | upper %}
|
||||
{% if ccLicense === 'zero' %}
|
||||
{% set ccType = 'publicdomain/zero/1.0/' + ccLanguage %}
|
||||
{% else %}
|
||||
{% set ccType = 'licenses/' + ccLicense + '/4.0/' + ccLanguage %}
|
||||
{% endif %}
|
||||
{% set ccURL = 'https://creativecommons.org/' + ccType %}
|
||||
|
||||
<ul class="post-copyright">
|
||||
<li class="post-copyright-author">
|
||||
<strong>{{ __('post.copyright.author') + __('symbol.colon') }} </strong>{#
|
||||
#}{{ post.author || author }}{#
|
||||
#}</li>
|
||||
<li class="post-copyright-link">
|
||||
<strong>{{ __('post.copyright.link') + __('symbol.colon') }}</strong>
|
||||
{% set postURL = post.url || post.permalink %}
|
||||
{{ next_url(postURL, postURL, {title: post.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>
|
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, post) %}
|
||||
{% if popular_posts.json and popular_posts.json.length > 0 %}
|
||||
<div class="popular-posts-header">{{ theme.related_posts.title | default(__('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 && 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 && 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/reward.swig
Normal file
22
themes/next/layout/_partials/post/reward.swig
Normal file
@ -0,0 +1,22 @@
|
||||
<div id="reward-container">
|
||||
<div>{{ theme.reward_settings.comment }}</div>
|
||||
<button id="reward-button" disable="enable" 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', 'bitcoin'] %}
|
||||
{% if builtin.indexOf(name) !== -1 %}
|
||||
{% 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>
|
4
themes/next/layout/_partials/post/wechat-subscriber.swig
Normal file
4
themes/next/layout/_partials/post/wechat-subscriber.swig
Normal file
@ -0,0 +1,4 @@
|
||||
<div id="wechat_subscriber" style="display: block; padding: 10px 0; margin: 20px auto; width: 100%; text-align: center;">
|
||||
<img id="wechat_subscriber_qcode" src="{{ url_for(theme.wechat_subscriber.qcode) }}" alt="{{ author }} wechat" style="width: 200px; max-width: 100%;"/>
|
||||
<div>{{ theme.wechat_subscriber.description }}</div>
|
||||
</div>
|
20
themes/next/layout/_partials/search/algolia-search.swig
Normal file
20
themes/next/layout/_partials/search/algolia-search.swig
Normal file
@ -0,0 +1,20 @@
|
||||
{% if theme.algolia_search.enable %}
|
||||
<div class="algolia-popup popup search-popup">
|
||||
<div class="algolia-search">
|
||||
<div class="algolia-search-input-icon">
|
||||
<i class="fa fa-search"></i>
|
||||
</div>
|
||||
<div class="algolia-search-input" id="algolia-search-input"></div>
|
||||
</div>
|
||||
|
||||
<div class="algolia-results">
|
||||
<div id="algolia-stats"></div>
|
||||
<div id="algolia-hits"></div>
|
||||
<div id="algolia-pagination" class="algolia-pagination"></div>
|
||||
</div>
|
||||
|
||||
<span class="popup-btn-close">
|
||||
<i class="fa fa-times-circle"></i>
|
||||
</span>
|
||||
</div>
|
||||
{% endif %}
|
7
themes/next/layout/_partials/search/index.swig
Normal file
7
themes/next/layout/_partials/search/index.swig
Normal file
@ -0,0 +1,7 @@
|
||||
{% if theme.algolia_search.enable %}
|
||||
{% include 'algolia-search.swig' %}
|
||||
{% elif theme.swiftype_key %}
|
||||
{% include 'swiftype.swig' %}
|
||||
{% elif theme.local_search.enable %}
|
||||
{% include 'localsearch.swig' %}
|
||||
{% endif %}
|
16
themes/next/layout/_partials/search/localsearch.swig
Normal file
16
themes/next/layout/_partials/search/localsearch.swig
Normal file
@ -0,0 +1,16 @@
|
||||
<div class="popup search-popup local-search-popup">
|
||||
<div class="local-search-header clearfix">
|
||||
<span class="search-icon">
|
||||
<i class="fa fa-search"></i>
|
||||
</span>
|
||||
<span class="popup-btn-close">
|
||||
<i class="fa fa-times-circle"></i>
|
||||
</span>
|
||||
<div class="local-search-input-wrapper">
|
||||
<input autocomplete="off"
|
||||
placeholder="{{ __('search.placeholder') }}" spellcheck="false"
|
||||
type="text" id="local-search-input">
|
||||
</div>
|
||||
</div>
|
||||
<div id="local-search-result"></div>
|
||||
</div>
|
12
themes/next/layout/_partials/search/swiftype.swig
Normal file
12
themes/next/layout/_partials/search/swiftype.swig
Normal file
@ -0,0 +1,12 @@
|
||||
<form class="site-search-form">
|
||||
<input type="text" id="st-search-input" class="st-search-input st-default-search-input"/>
|
||||
</form>
|
||||
|
||||
<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>
|
3
themes/next/layout/_partials/share/add-this.swig
Normal file
3
themes/next/layout/_partials/share/add-this.swig
Normal file
@ -0,0 +1,3 @@
|
||||
<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>
|
57
themes/next/layout/_partials/share/baidushare.swig
Normal file
57
themes/next/layout/_partials/share/baidushare.swig
Normal file
@ -0,0 +1,57 @@
|
||||
{% if theme.baidushare.type === "button" %}
|
||||
<div class="bdsharebuttonbox">
|
||||
<a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a>
|
||||
<a href="#" class="bds_douban" data-cmd="douban" title="分享到豆瓣网"></a>
|
||||
<a href="#" class="bds_sqq" data-cmd="sqq" title="分享到QQ好友"></a>
|
||||
<a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a>
|
||||
<a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a>
|
||||
<a href="#" class="bds_tieba" data-cmd="tieba" title="分享到百度贴吧"></a>
|
||||
<a href="#" class="bds_twi" data-cmd="twi" title="分享到Twitter"></a>
|
||||
<a href="#" class="bds_fbook" data-cmd="fbook" title="分享到Facebook"></a>
|
||||
<a href="#" class="bds_more" data-cmd="more"></a>
|
||||
<a class="bds_count" data-cmd="count"></a>
|
||||
</div>
|
||||
<script>
|
||||
window._bd_share_config = {
|
||||
"common": {
|
||||
"bdText": "",
|
||||
"bdMini": "2",
|
||||
"bdMiniList": false,
|
||||
"bdPic": ""
|
||||
},
|
||||
"share": {
|
||||
"bdSize": "16",
|
||||
"bdStyle": "0"
|
||||
},
|
||||
"image": {
|
||||
"viewList": ["tsina", "douban", "sqq", "qzone", "weixin", "twi", "fbook"],
|
||||
"viewText": "分享到:",
|
||||
"viewSize": "16"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{% elif theme.baidushare.type === "slide" %}
|
||||
<script>
|
||||
window._bd_share_config = {
|
||||
"common": {
|
||||
"bdText": "",
|
||||
"bdMini": "1",
|
||||
"bdMiniList": false,
|
||||
"bdPic": ""
|
||||
},
|
||||
"image": {
|
||||
"viewList": ["tsina", "douban", "sqq", "qzone", "weixin", "twi", "fbook"],
|
||||
"viewText": "分享到:",
|
||||
"viewSize": "16"
|
||||
},
|
||||
"slide": {
|
||||
"bdImg": "5",
|
||||
"bdPos": "left",
|
||||
"bdTop": "100"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{% endif %}
|
||||
<script>
|
||||
with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='//bdimg.share.baidu.com/static/api/js/share.js?cdnversion='+~(-new Date()/36e5)];
|
||||
</script>
|
23
themes/next/layout/_partials/share/likely.swig
Normal file
23
themes/next/layout/_partials/share/likely.swig
Normal file
@ -0,0 +1,23 @@
|
||||
{% set likely_js_url = '//cdn.jsdelivr.net/npm/ilyabirman-likely@2/release/likely.js' %}
|
||||
{% if theme.vendors.likely_js %}
|
||||
{% set likely_js_url = theme.vendors.likely_js %}
|
||||
{% endif %}
|
||||
<script src="{{ likely_js_url }}"></script>
|
||||
|
||||
{% set likely_css_url = '//cdn.jsdelivr.net/npm/ilyabirman-likely@2/release/likely.css' %}
|
||||
{% if theme.vendors.likely_css %}
|
||||
{% set likely_css_url = theme.vendors.likely_css %}
|
||||
{% endif %}
|
||||
<link rel="stylesheet" href="{{ likely_css_url }}">
|
||||
|
||||
{% if theme.likely.look == 'normal' %}
|
||||
{% set likely_look = 'likely' %}
|
||||
{% else %}
|
||||
{% set likely_look = 'likely likely-' + theme.likely.look %}
|
||||
{% endif %}
|
||||
|
||||
<div class="{{ likely_look }}">
|
||||
{% for x in theme.likely.networks %}
|
||||
<div class="{{ loop.key }}">{{ x }}</div>
|
||||
{% endfor %}
|
||||
</div>
|
10
themes/next/layout/_scripts/commons.swig
Normal file
10
themes/next/layout/_scripts/commons.swig
Normal file
@ -0,0 +1,10 @@
|
||||
{%
|
||||
set js_commons = [
|
||||
'utils.js',
|
||||
'motion.js'
|
||||
]
|
||||
%}
|
||||
|
||||
{% for common in js_commons %}
|
||||
<script src="{{ url_for(theme.js) }}/{{ common }}?v={{ version }}"></script>
|
||||
{% endfor %}
|
3
themes/next/layout/_scripts/exturl.swig
Normal file
3
themes/next/layout/_scripts/exturl.swig
Normal file
@ -0,0 +1,3 @@
|
||||
{% if theme.exturl %}
|
||||
<script src="{{ url_for(theme.js) }}/exturl.js?v={{ version }}"></script>
|
||||
{% endif %}
|
9
themes/next/layout/_scripts/next-boot.swig
Normal file
9
themes/next/layout/_scripts/next-boot.swig
Normal file
@ -0,0 +1,9 @@
|
||||
{%
|
||||
set boot_scripts = [
|
||||
'next-boot.js'
|
||||
]
|
||||
%}
|
||||
|
||||
{% for bs in boot_scripts %}
|
||||
<script src="{{ url_for(theme.js) }}/{{ bs }}?v={{ version }}"></script>
|
||||
{% endfor %}
|
24
themes/next/layout/_scripts/noscript.swig
Normal file
24
themes/next/layout/_scripts/noscript.swig
Normal file
@ -0,0 +1,24 @@
|
||||
<noscript>
|
||||
<style>
|
||||
.use-motion .motion-element,
|
||||
.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-title { opacity: initial; }
|
||||
|
||||
.use-motion .logo,
|
||||
.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>
|
2
themes/next/layout/_scripts/pages/post-details.swig
Normal file
2
themes/next/layout/_scripts/pages/post-details.swig
Normal file
@ -0,0 +1,2 @@
|
||||
<script src="{{ url_for(theme.js) }}/scrollspy.js?v={{ version }}"></script>
|
||||
<script src="{{ url_for(theme.js) }}/post-details.js?v={{ version }}"></script>
|
1
themes/next/layout/_scripts/schemes/gemini.swig
Normal file
1
themes/next/layout/_scripts/schemes/gemini.swig
Normal file
@ -0,0 +1 @@
|
||||
{% include 'pisces.swig' %}
|
1
themes/next/layout/_scripts/schemes/mist.swig
Normal file
1
themes/next/layout/_scripts/schemes/mist.swig
Normal file
@ -0,0 +1 @@
|
||||
{% include 'muse.swig' %}
|
9
themes/next/layout/_scripts/schemes/muse.swig
Normal file
9
themes/next/layout/_scripts/schemes/muse.swig
Normal file
@ -0,0 +1,9 @@
|
||||
{%
|
||||
set scripts = [
|
||||
'schemes/muse.js'
|
||||
]
|
||||
%}
|
||||
|
||||
{% for script in scripts %}
|
||||
<script src="{{ url_for(theme.js) }}/{{ script }}?v={{ version }}"></script>
|
||||
{% endfor %}
|
10
themes/next/layout/_scripts/schemes/pisces.swig
Normal file
10
themes/next/layout/_scripts/schemes/pisces.swig
Normal file
@ -0,0 +1,10 @@
|
||||
{%
|
||||
set scripts = [
|
||||
'affix.js',
|
||||
'schemes/pisces.js'
|
||||
]
|
||||
%}
|
||||
|
||||
{% for script in scripts %}
|
||||
<script src="{{ url_for(theme.js) }}/{{ script }}?v={{ version }}"></script>
|
||||
{% endfor %}
|
4
themes/next/layout/_scripts/scroll-cookie.swig
Normal file
4
themes/next/layout/_scripts/scroll-cookie.swig
Normal file
@ -0,0 +1,4 @@
|
||||
{% if theme.save_scroll %}
|
||||
<script src="{{ url_for(theme.js) }}/js.cookie.js?v={{ version }}"></script>
|
||||
<script src="{{ url_for(theme.js) }}/scroll-cookie.js?v={{ version }}"></script>
|
||||
{% endif %}
|
72
themes/next/layout/_scripts/vendors.swig
Normal file
72
themes/next/layout/_scripts/vendors.swig
Normal file
@ -0,0 +1,72 @@
|
||||
{# Reset `window.Promise` when it was not a function. #}
|
||||
{# IE refers the element whose id is `Promise` as `window.Promise`, this causes Velocity throwing an exception #}
|
||||
<script>
|
||||
if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
|
||||
window.Promise = null;
|
||||
}
|
||||
</script>
|
||||
|
||||
{% set js_vendors = {} %}
|
||||
{% set js_vendors.jquery = 'jquery/index.js?v=2.1.3' %}
|
||||
|
||||
{% if theme.fastclick %}
|
||||
{% set js_vendors.fastclick = 'fastclick/lib/fastclick.min.js?v=1.0.6' %}
|
||||
{% endif %}
|
||||
|
||||
{% if theme.lazyload %}
|
||||
{% set js_vendors.lazyload = 'jquery_lazyload/jquery.lazyload.js?v=1.9.7' %}
|
||||
{% endif %}
|
||||
|
||||
{% set js_vendors.velocity = 'velocity/velocity.min.js?v=1.2.1' %}
|
||||
{% set js_vendors.velocity_ui = 'velocity/velocity.ui.min.js?v=1.2.1' %}
|
||||
|
||||
{% if theme.fancybox %}
|
||||
{% set js_vendors.fancybox = 'fancybox/source/jquery.fancybox.pack.js' %}
|
||||
{% endif %}
|
||||
|
||||
{% if theme.canvas_nest.enable %}
|
||||
{% if theme.canvas_nest.onmobile %}
|
||||
{% set canvas_nest_uri = url_for(theme.vendors._internal + '/canvas-nest/canvas-nest.min.js') %}
|
||||
{% if theme.vendors.canvas_nest %}
|
||||
{% set canvas_nest_uri = theme.vendors.canvas_nest %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% set canvas_nest_uri = url_for(theme.vendors._internal + '/canvas-nest/canvas-nest-nomobile.min.js') %}
|
||||
{% if theme.vendors.canvas_nest_nomobile %}
|
||||
{% set canvas_nest_uri = theme.vendors.canvas_nest_nomobile %}
|
||||
{% endif %}
|
||||
{% 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.three_waves %}
|
||||
{% set js_vendors.three = 'three/three.min.js' %}
|
||||
{% set js_vendors.three_waves = 'three/three-waves.min.js' %}
|
||||
{% endif %}
|
||||
|
||||
{% if theme.canvas_lines %}
|
||||
{% set js_vendors.three = 'three/three.min.js' %}
|
||||
{% set js_vendors.canvas_lines = 'three/canvas_lines.min.js' %}
|
||||
{% endif %}
|
||||
|
||||
{% if theme.canvas_sphere %}
|
||||
{% set js_vendors.three = 'three/three.min.js' %}
|
||||
{% set js_vendors.canvas_sphere = 'three/canvas_sphere.min.js' %}
|
||||
{% endif %}
|
||||
|
||||
{% if theme.canvas_ribbon.enable %}
|
||||
{% set canvas_ribbon_uri = url_for(theme.vendors._internal + '/canvas-ribbon/canvas-ribbon.js') %}
|
||||
{% if theme.vendors.canvas_ribbon %}
|
||||
{% set canvas_ribbon_uri = theme.vendors.canvas_ribbon %}
|
||||
{% endif %}
|
||||
<script id="ribbon" size="{{ theme.canvas_ribbon.size }}" alpha="{{ theme.canvas_ribbon.alpha }}" zIndex="{{theme.canvas_ribbon.zIndex }}" src="{{ canvas_ribbon_uri }}"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if theme.reading_progress.enable %}
|
||||
{% set js_vendors.reading_progress = 'reading_progress/reading_progress.js' %}
|
||||
{% endif %}
|
||||
|
||||
{% for name, internal in js_vendors %}
|
||||
{% set internal_script = url_for(theme.vendors._internal + '/' + internal) %}
|
||||
<script src="{{ theme.vendors[name] | default(internal_script) }}"></script>
|
||||
{% endfor %}
|
4
themes/next/layout/_third-party/analytics/analytics-with-widget.swig
vendored
Normal file
4
themes/next/layout/_third-party/analytics/analytics-with-widget.swig
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
{% include 'busuanzi-counter.swig' %}
|
||||
{% include 'tencent-mta.swig' %}
|
||||
{% include 'tencent-analytics.swig' %}
|
||||
{% include 'cnzz-analytics.swig' %}
|
11
themes/next/layout/_third-party/analytics/application-insights.swig
vendored
Normal file
11
themes/next/layout/_third-party/analytics/application-insights.swig
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
{% if theme.application_insights %}
|
||||
<script>
|
||||
var appInsights=window.appInsights||function(config){
|
||||
function i(config){t[config]=function(){var i=arguments;t.queue.push(function(){t[config].apply(t,i)})}}var t={config:config},u=document,e=window,o="script",s="AuthenticatedUserContext",h="start",c="stop",l="Track",a=l+"Event",v=l+"Page",y=u.createElement(o),r,f;y.src=config.url||"https://az416426.vo.msecnd.net/scripts/a/ai.0.js";u.getElementsByTagName(o)[0].parentNode.appendChild(y);try{t.cookie=u.cookie}catch(p){}for(t.queue=[],t.version="1.0",r=["Event","Exception","Metric","PageView","Trace","Dependency"];r.length;)i("track"+r.pop());return i("set"+s),i("clear"+s),i(h+a),i(c+a),i(h+v),i(c+v),i("flush"),config.disableExceptionTracking||(r="onerror",i("_"+r),f=e[r],e[r]=function(config,i,u,e,o){var s=f&&f(config,i,u,e,o);return s!==!0&&t["_"+r](config,i,u,e,o),s}),t
|
||||
}({
|
||||
instrumentationKey:"{{ theme.application_insights }}"
|
||||
});
|
||||
window.appInsights=appInsights;
|
||||
appInsights.trackPageView();
|
||||
</script>
|
||||
{% endif %}
|
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>
|
||||
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 %}
|
27
themes/next/layout/_third-party/analytics/busuanzi-counter.swig
vendored
Normal file
27
themes/next/layout/_third-party/analytics/busuanzi-counter.swig
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
{% if theme.busuanzi_count.enable %}
|
||||
<div class="busuanzi-count">
|
||||
<script 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-icon">
|
||||
<i class="fa fa-{{ theme.busuanzi_count.total_visitors_icon }}"></i>
|
||||
</span>
|
||||
<span class="site-uv" title="{{ __('footer.total_visitors') }}">
|
||||
<span class="busuanzi-value" id="busuanzi_value_site_uv"></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-icon">
|
||||
<i class="fa fa-{{ theme.busuanzi_count.total_views_icon }}"></i>
|
||||
</span>
|
||||
<span class="site-pv" title="{{ __('footer.total_views') }}">
|
||||
<span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
5
themes/next/layout/_third-party/analytics/cnzz-analytics.swig
vendored
Normal file
5
themes/next/layout/_third-party/analytics/cnzz-analytics.swig
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
{% if theme.cnzz_siteid %}
|
||||
<div style="display: none;">
|
||||
<script src="//s95.cnzz.com/z_stat.php?id={{ theme.cnzz_siteid }}&web_id={{ theme.cnzz_siteid }}"></script>
|
||||
</div>
|
||||
{% endif %}
|
18
themes/next/layout/_third-party/analytics/facebook-sdk.swig
vendored
Normal file
18
themes/next/layout/_third-party/analytics/facebook-sdk.swig
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
{% if theme.facebook_sdk.enable %}
|
||||
<script>
|
||||
window.fbAsyncInit = function() {
|
||||
FB.init({
|
||||
appId : '{{ theme.facebook_sdk.app_id }}',
|
||||
xfbml : true,
|
||||
version: 'v3.3'
|
||||
});
|
||||
};
|
||||
(function(d, s, id) {
|
||||
var js, fjs = d.getElementsByTagName(s)[0];
|
||||
if (d.getElementById(id)) {return;}
|
||||
js = d.createElement(s); js.id = id;
|
||||
js.src = "//connect.facebook.net/{{ config.language|replace('-', '_') }}/sdk.js";
|
||||
fjs.parentNode.insertBefore(js, fjs);
|
||||
}(document, 'script', 'facebook-jssdk'));
|
||||
</script>
|
||||
{% endif %}
|
99
themes/next/layout/_third-party/analytics/firestore.swig
vendored
Normal file
99
themes/next/layout/_third-party/analytics/firestore.swig
vendored
Normal file
@ -0,0 +1,99 @@
|
||||
{% if theme.firestore.enable %}
|
||||
<script src="https://www.gstatic.com/firebasejs/4.6.0/firebase.js"></script>
|
||||
<script src="https://www.gstatic.com/firebasejs/4.6.0/firebase-firestore.js"></script>
|
||||
{% if theme.firestore.bluebird %}
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.5.1/bluebird.core.min.js"></script>
|
||||
{% endif %}
|
||||
<script>
|
||||
(function () {
|
||||
|
||||
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(function (d) {
|
||||
var count
|
||||
if (!d.exists) { //has no data, initialize count
|
||||
if (increaseCount) {
|
||||
doc.set({
|
||||
count: 1
|
||||
})
|
||||
count = 1
|
||||
}
|
||||
else {
|
||||
count = 0
|
||||
}
|
||||
}
|
||||
else { //has data
|
||||
count = d.data().count
|
||||
if (increaseCount) {
|
||||
if (!(window.localStorage && window.localStorage.getItem(title))) { //if first view this article
|
||||
doc.set({ //increase count
|
||||
count: count + 1
|
||||
})
|
||||
count++
|
||||
}
|
||||
}
|
||||
}
|
||||
if (window.localStorage && increaseCount) { //mark as visited
|
||||
localStorage.setItem(title, true)
|
||||
}
|
||||
|
||||
return count
|
||||
})
|
||||
}
|
||||
|
||||
function appendCountTo(el) {
|
||||
return function (count) {
|
||||
$(el).append(
|
||||
$('<span>').addClass('post-visitors-count').append(
|
||||
$('<span>').addClass('post-meta-divider').text('|')
|
||||
).append(
|
||||
$('<span>').addClass('post-meta-item-icon').append(
|
||||
$('<i>').addClass('fa fa-users')
|
||||
)
|
||||
).append($('<span>').text('{{ __("post.views")}} ' + count))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
var db = firebase.firestore()
|
||||
var articles = db.collection('{{ theme.firestore.collection }}')
|
||||
|
||||
//https://hexo.io/docs/variables.html
|
||||
var isPost = '{{ page.title }}'.length > 0
|
||||
var isArchive = '{{ page.archive }}' === 'true'
|
||||
var isCategory = '{{ page.category }}'.length > 0
|
||||
var isTag = '{{ page.tag }}'.length > 0
|
||||
|
||||
if (isPost) { //is article page
|
||||
var title = '{{ page.title }}'
|
||||
var doc = articles.doc(title)
|
||||
|
||||
getCount(doc, true).then(appendCountTo($('.post-meta')))
|
||||
}
|
||||
else if (!isArchive && !isCategory && !isTag) { //is index page
|
||||
var titles = [] //array to titles
|
||||
|
||||
var postsstr = '{% for post in page.posts %}titles.push("{{ post.title }}");{% endfor %}' //if you have a better way to get titles of posts, please change it
|
||||
eval(postsstr)
|
||||
|
||||
var promises = titles.map(function (title) {
|
||||
return articles.doc(title)
|
||||
}).map(function (doc) {
|
||||
return getCount(doc)
|
||||
})
|
||||
Promise.all(promises).then(function (counts) {
|
||||
var metas = $('.post-meta')
|
||||
counts.forEach(function (val, idx) {
|
||||
appendCountTo(metas[idx])(val)
|
||||
})
|
||||
})
|
||||
}
|
||||
})()
|
||||
</script>
|
||||
{% endif %}
|
12
themes/next/layout/_third-party/analytics/google-analytics.swig
vendored
Normal file
12
themes/next/layout/_third-party/analytics/google-analytics.swig
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
{% if theme.google_analytics.tracking_id %}
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id={{ theme.google_analytics.tracking_id }}"></script>
|
||||
<script>
|
||||
var host = window.location.hostname;
|
||||
if (host !== "localhost" || !{{theme.google_analytics.localhost_ignored}}) {
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
gtag('config', '{{ theme.google_analytics.tracking_id }}');
|
||||
}
|
||||
</script>
|
||||
{% 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>
|
||||
!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 %}
|
6
themes/next/layout/_third-party/analytics/index.swig
vendored
Normal file
6
themes/next/layout/_third-party/analytics/index.swig
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
{% include 'facebook-sdk.swig' %}
|
||||
{% include 'vkontakte-api.swig' %}
|
||||
{% include 'google-analytics.swig' %}
|
||||
{% include 'baidu-analytics.swig' %}
|
||||
{% include 'application-insights.swig' %}
|
||||
{% include 'growingio.swig' %}
|
116
themes/next/layout/_third-party/analytics/lean-analytics.swig
vendored
Normal file
116
themes/next/layout/_third-party/analytics/lean-analytics.swig
vendored
Normal file
@ -0,0 +1,116 @@
|
||||
{% if theme.leancloud_visitors.enable and !theme.valine.visitor %}
|
||||
{# custom analytics part create by xiamo; edited by LEAFERx #}
|
||||
<script>
|
||||
{% if page.layout === 'post' %}
|
||||
function addCount(Counter) {
|
||||
var $visitors = $('.leancloud_visitors');
|
||||
var url = $visitors.attr('id').trim();
|
||||
var title = $visitors.attr('data-flag-title').trim();
|
||||
|
||||
Counter('get', '/classes/Counter', { where: JSON.stringify({ url }) })
|
||||
.done(function({ results }) {
|
||||
if (results.length > 0) {
|
||||
var counter = results[0];
|
||||
{% if theme.leancloud_visitors.betterPerformance %}
|
||||
var $element = $(document.getElementById(url));
|
||||
$element.find('.leancloud-visitors-count').text(counter.time + 1);
|
||||
{% endif %}
|
||||
Counter('put', '/classes/Counter/' + counter.objectId, JSON.stringify({ time: { '__op': 'Increment', 'amount': 1 } }))
|
||||
{% if not theme.leancloud_visitors.betterPerformance %}
|
||||
.done(function() {
|
||||
var $element = $(document.getElementById(url));
|
||||
$element.find('.leancloud-visitors-count').text(counter.time + 1);
|
||||
})
|
||||
{% endif %}
|
||||
.fail(function ({ responseJSON }) {
|
||||
console.log('Failed to save Visitor num, with error message: ' + responseJSON.error);
|
||||
})
|
||||
} else {
|
||||
{% if theme.leancloud_visitors.security %}
|
||||
var $element = $(document.getElementById(url));
|
||||
$element.find('.leancloud-visitors-count').text('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', JSON.stringify({ title: title, url: url, time: 1 }))
|
||||
.done(function() {
|
||||
var $element = $(document.getElementById(url));
|
||||
$element.find('.leancloud-visitors-count').text(1);
|
||||
})
|
||||
.fail(function() {
|
||||
console.log('Failed to create');
|
||||
});
|
||||
{% endif %}
|
||||
}
|
||||
})
|
||||
.fail(function ({ responseJSON }) {
|
||||
console.log('LeanCloud Counter Error: ' + responseJSON.code + ' ' + responseJSON.error);
|
||||
});
|
||||
}
|
||||
{% else %}
|
||||
function showTime(Counter) {
|
||||
var entries = [];
|
||||
var $visitors = $('.leancloud_visitors');
|
||||
|
||||
$visitors.each(function() {
|
||||
entries.push( $(this).attr('id').trim() );
|
||||
});
|
||||
|
||||
Counter('get', '/classes/Counter', { where: JSON.stringify({ url: { '$in': entries } }) })
|
||||
.done(function({ results }) {
|
||||
var COUNT_CONTAINER_REF = '.leancloud-visitors-count';
|
||||
|
||||
if (results.length === 0) {
|
||||
$visitors.find(COUNT_CONTAINER_REF).text(0);
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i = 0; i < results.length; i++) {
|
||||
var item = results[i];
|
||||
var url = item.url;
|
||||
var time = item.time;
|
||||
var element = document.getElementById(url);
|
||||
|
||||
$(element).find(COUNT_CONTAINER_REF).text(time);
|
||||
}
|
||||
for (var i = 0; i < entries.length; i++) {
|
||||
var url = entries[i];
|
||||
var element = document.getElementById(url);
|
||||
var countSpan = $(element).find(COUNT_CONTAINER_REF);
|
||||
if (countSpan.text() == '') {
|
||||
countSpan.text(0);
|
||||
}
|
||||
}
|
||||
})
|
||||
.fail(function ({ responseJSON }) {
|
||||
console.log('LeanCloud Counter Error: ' + responseJSON.code + ' ' + responseJSON.error);
|
||||
});
|
||||
}
|
||||
{% endif %}
|
||||
|
||||
$(function() {
|
||||
$.get('https://app-router.leancloud.cn/2/route?appId=' + '{{ theme.leancloud_visitors.app_id }}')
|
||||
.done(function({ api_server }) {
|
||||
var Counter = function(method, url, data) {
|
||||
return $.ajax({
|
||||
method: method,
|
||||
url: 'https://' + api_server + '/1.1' + url,
|
||||
headers: {
|
||||
'X-LC-Id': '{{ theme.leancloud_visitors.app_id }}',
|
||||
'X-LC-Key': '{{ theme.leancloud_visitors.app_key }}',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: data
|
||||
});
|
||||
};
|
||||
{% if page.layout === 'post' %}
|
||||
addCount(Counter);
|
||||
{% else %}
|
||||
if ($('.post-title-link').length >= 1) {
|
||||
showTime(Counter);
|
||||
}
|
||||
{% endif %}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endif %}
|
10
themes/next/layout/_third-party/analytics/tencent-analytics.swig
vendored
Normal file
10
themes/next/layout/_third-party/analytics/tencent-analytics.swig
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
{% if theme.tencent_analytics %}
|
||||
<script>
|
||||
(function() {
|
||||
var hm = document.createElement("script");
|
||||
hm.src = "//tajs.qq.com/stats?sId={{ theme.tencent_analytics }}";
|
||||
var s = document.getElementsByTagName("script")[0];
|
||||
s.parentNode.insertBefore(hm, s);
|
||||
})();
|
||||
</script>
|
||||
{% endif %}
|
13
themes/next/layout/_third-party/analytics/tencent-mta.swig
vendored
Normal file
13
themes/next/layout/_third-party/analytics/tencent-mta.swig
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
{% if theme.tencent_mta %}
|
||||
<script>
|
||||
var _mtac = {};
|
||||
(function() {
|
||||
var mta = document.createElement("script");
|
||||
mta.src = "https://pingjs.qq.com/h5/stats.js";
|
||||
mta.setAttribute("name", "MTAH5");
|
||||
mta.setAttribute("sid", "{{theme.tencent_mta}}");
|
||||
var s = document.getElementsByTagName("script")[0];
|
||||
s.parentNode.insertBefore(mta, s);
|
||||
})();
|
||||
</script>
|
||||
{% endif %}
|
25
themes/next/layout/_third-party/analytics/vkontakte-api.swig
vendored
Normal file
25
themes/next/layout/_third-party/analytics/vkontakte-api.swig
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
{% if theme.vkontakte_api.enable %}
|
||||
<div id="vk_api_transport"></div>
|
||||
<script>
|
||||
window.vkAsyncInit = function() {
|
||||
VK.init({
|
||||
apiId: {{ theme.vkontakte_api.app_id }}
|
||||
});
|
||||
|
||||
{% if not is_home() and (is_post() and theme.vkontakte_api.like) %}
|
||||
VK.Widgets.Like("vk_like", {type: "mini", height: 20});
|
||||
{% endif %}
|
||||
|
||||
{% if page.comments and theme.vkontakte_api.comments %}
|
||||
VK.Widgets.Comments("vk_comments", {limit: {{ theme.vkontakte_api.num_of_posts }}, attach: "*"});
|
||||
{% endif %}
|
||||
};
|
||||
setTimeout(function() {
|
||||
var el = document.createElement("script");
|
||||
el.type = "text/javascript";
|
||||
el.src = "//vk.com/js/api/openapi.js";
|
||||
el.async = true;
|
||||
document.getElementById("vk_api_transport").appendChild(el);
|
||||
}, 0);
|
||||
</script>
|
||||
{% endif %}
|
11
themes/next/layout/_third-party/baidu-push.swig
vendored
Normal file
11
themes/next/layout/_third-party/baidu-push.swig
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
{% if theme.baidu_push %}
|
||||
<script>
|
||||
(function(){
|
||||
var bp = document.createElement('script');
|
||||
var curProtocol = window.location.protocol.split(':')[0];
|
||||
bp.src = (curProtocol === 'https') ? 'https://zz.bdstatic.com/linksubmit/push.js' : 'http://push.zhanzhang.baidu.com/push.js';
|
||||
var s = document.getElementsByTagName("script")[0];
|
||||
s.parentNode.insertBefore(bp, s);
|
||||
})();
|
||||
</script>
|
||||
{% endif %}
|
14
themes/next/layout/_third-party/bookmark.swig
vendored
Normal file
14
themes/next/layout/_third-party/bookmark.swig
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
{% if theme.bookmark and theme.bookmark.enable %}
|
||||
{% set bookmark_uri = url_for(theme.vendors._internal + '/bookmark/bookmark.min.js?v=1.0') %}
|
||||
{% if theme.vendors.bookmark %}
|
||||
{% set bookmark_uri = theme.vendors.bookmark %}
|
||||
{% endif %}
|
||||
<script src="{{ bookmark_uri }}"></script>
|
||||
<script>
|
||||
{% if is_post() %}
|
||||
bookmark.scrollToMark('{{ theme.bookmark.save }}', "#{{ __('post.more') }}");
|
||||
{% else %}
|
||||
bookmark.loadBookmark();
|
||||
{% endif %}
|
||||
</script>
|
||||
{% endif %}
|
22
themes/next/layout/_third-party/chatra.swig
vendored
Normal file
22
themes/next/layout/_third-party/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 %}
|
18
themes/next/layout/_third-party/comments/changyan.swig
vendored
Normal file
18
themes/next/layout/_third-party/comments/changyan.swig
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
{% 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>
|
||||
(function() {
|
||||
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 %}
|
44
themes/next/layout/_third-party/comments/disqus.swig
vendored
Normal file
44
themes/next/layout/_third-party/comments/disqus.swig
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
{% if theme.disqus.count %}
|
||||
<script id="dsq-count-scr" src="https://{{ theme.disqus.shortname }}.disqus.com/count.js" async></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 | addslashes }}';
|
||||
{% if __('disqus') !== 'disqus' -%}
|
||||
this.language = '{{ __('disqus') }}';
|
||||
{% endif -%}
|
||||
};
|
||||
function loadComments() {
|
||||
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);
|
||||
}
|
||||
{% if theme.disqus.lazyload %}
|
||||
$(function() {
|
||||
var offsetTop = $('#comments').offset().top - $(window).height();
|
||||
if (offsetTop <= 0) {
|
||||
// load directly when there's no a scrollbar
|
||||
loadComments();
|
||||
} else {
|
||||
$(window).on('scroll.disqus_scroll', function() {
|
||||
// offsetTop may changes because of manually resizing browser window or lazy loading images.
|
||||
var offsetTop = $('#comments').offset().top - $(window).height();
|
||||
var scrollTop = $(window).scrollTop();
|
||||
|
||||
// pre-load comments a bit? (margin or anything else)
|
||||
if (offsetTop - scrollTop < 60) {
|
||||
$(window).off('.disqus_scroll');
|
||||
loadComments();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
{% else %}
|
||||
loadComments();
|
||||
{% endif %}
|
||||
</script>
|
||||
{% endif %}
|
19
themes/next/layout/_third-party/comments/disqusjs.swig
vendored
Normal file
19
themes/next/layout/_third-party/comments/disqusjs.swig
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
{% set disqusjs_css_url = '//cdn.jsdelivr.net/npm/disqusjs@1/dist/disqusjs.css' %}
|
||||
{% if theme.vendors.disqusjs_css %}
|
||||
{% set disqusjs_css_url = theme.vendors.disqusjs_css %}
|
||||
{% endif %}
|
||||
<link rel="stylesheet" href="{{ disqusjs_css_url }}"/>
|
||||
|
||||
{% set disqusjs_js_url = '//cdn.jsdelivr.net/npm/disqusjs@1/dist/disqus.js' %}
|
||||
{% if theme.vendors.disqusjs_js %}
|
||||
{% set disqusjs_js_url = theme.vendors.disqusjs_js %}
|
||||
{% endif %}
|
||||
<script src="{{ disqusjs_js_url }}"></script>
|
||||
|
||||
<script>
|
||||
var dsqjs = new DisqusJS({
|
||||
api: '{{ theme.disqusjs.api }}' || 'https://disqus.com/api/',
|
||||
apikey: '{{ theme.disqusjs.apikey }}',
|
||||
shortname: '{{ theme.disqusjs.shortname }}'
|
||||
});
|
||||
</script>
|
35
themes/next/layout/_third-party/comments/gitalk.swig
vendored
Normal file
35
themes/next/layout/_third-party/comments/gitalk.swig
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
{% set gitalk_js_url = '//cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js' %}
|
||||
{% if theme.vendors.gitalk_js %}
|
||||
{% set gitalk_js_url = theme.vendors.gitalk_js %}
|
||||
{% endif %}
|
||||
<script src="{{ gitalk_js_url }}"></script>
|
||||
|
||||
{% set gitalk_css_url = '//cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.css' %}
|
||||
{% if theme.vendors.gitalk_css %}
|
||||
{% set gitalk_css_url = theme.vendors.gitalk_css %}
|
||||
{% endif %}
|
||||
<link rel="stylesheet" href="{{ gitalk_css_url }}"/>
|
||||
|
||||
{% set md5_url = '//cdn.jsdelivr.net/npm/js-md5@0.7.3/src/md5.min.js' %}
|
||||
{% if theme.vendors.md5 %}
|
||||
{% set md5_url = theme.vendors.md5 %}
|
||||
{% endif %}
|
||||
<script src="{{ md5_url }}"></script>
|
||||
|
||||
<script>
|
||||
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: md5(location.pathname),
|
||||
{% 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');
|
||||
</script>
|
45
themes/next/layout/_third-party/comments/gitment.swig
vendored
Normal file
45
themes/next/layout/_third-party/comments/gitment.swig
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
<!-- LOCAL: You can save these files to your site and update links -->
|
||||
{% if theme.gitment.mint %}
|
||||
{% set CommentsClass = 'Gitmint' %}
|
||||
<script src="https://cdn.jsdelivr.net/gh/theme-next/theme-next-gitment@1/gitmint.browser.js"></script>
|
||||
{% else %}
|
||||
{% set CommentsClass = 'Gitment' %}
|
||||
<script src="https://cdn.jsdelivr.net/gh/theme-next/theme-next-gitment@1/gitment.browser.js"></script>
|
||||
{% endif %}
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/theme-next/theme-next-gitment@1/default.css"/>
|
||||
<!-- END LOCAL -->
|
||||
|
||||
<script>
|
||||
function renderGitment() {
|
||||
var gitment = new {{ CommentsClass }}({
|
||||
id: window.location.pathname,
|
||||
owner: '{{ theme.gitment.github_user }}',
|
||||
repo: '{{ theme.gitment.github_repo }}',
|
||||
{% if theme.gitment.mint %}
|
||||
lang: '{{ theme.gitment.language }}' || navigator.language || navigator.systemLanguage || navigator.userLanguage,
|
||||
{% endif %}
|
||||
oauth: {
|
||||
{% if theme.gitment.mint and theme.gitment.redirect_protocol %}
|
||||
redirect_protocol: '{{ theme.gitment.redirect_protocol }}',
|
||||
{% endif %}
|
||||
{% if theme.gitment.mint and theme.gitment.proxy_gateway %}
|
||||
proxy_gateway: '{{ theme.gitment.proxy_gateway }}',
|
||||
{% else %}
|
||||
client_secret: '{{ theme.gitment.client_secret }}',
|
||||
{% endif %}
|
||||
client_id: '{{ theme.gitment.client_id }}'
|
||||
}
|
||||
});
|
||||
gitment.render('gitment-container');
|
||||
}
|
||||
|
||||
{% if not theme.gitment.lazy %}
|
||||
renderGitment();
|
||||
{% else %}
|
||||
function showGitment() {
|
||||
document.getElementById('gitment-display-button').style.display = 'none';
|
||||
document.getElementById('gitment-container').style.display = 'block';
|
||||
renderGitment();
|
||||
}
|
||||
{% endif %}
|
||||
</script>
|
19
themes/next/layout/_third-party/comments/index.swig
vendored
Normal file
19
themes/next/layout/_third-party/comments/index.swig
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
{% if theme.disqus.enable %}
|
||||
{% include 'disqus.swig' %}
|
||||
{% elif theme.changyan.enable and theme.changyan.appid and theme.changyan.appkey %}
|
||||
{% include 'changyan.swig' %}
|
||||
{% elif theme.valine.enable and theme.valine.appid and theme.valine.appkey %}
|
||||
{% include 'valine.swig' %}
|
||||
{% endif %}
|
||||
|
||||
{% if page.comments %}
|
||||
{% if theme.livere_uid %}
|
||||
{% include 'livere.swig' %}
|
||||
{% elif theme.gitment.enable and theme.gitment.client_id %}
|
||||
{% include 'gitment.swig' %}
|
||||
{% elif theme.gitalk.enable %}
|
||||
{% include 'gitalk.swig' %}
|
||||
{% elif theme.disqusjs.enable and theme.disqusjs.apikey and theme.disqusjs.shortname %}
|
||||
{% include 'disqusjs.swig' %}
|
||||
{% endif %}
|
||||
{% endif %}
|
13
themes/next/layout/_third-party/comments/livere.swig
vendored
Normal file
13
themes/next/layout/_third-party/comments/livere.swig
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
<script>
|
||||
window.livereOptions = {
|
||||
refer: '{{ page.path }}'
|
||||
};
|
||||
(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>
|
32
themes/next/layout/_third-party/comments/valine.swig
vendored
Normal file
32
themes/next/layout/_third-party/comments/valine.swig
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
{% set leancloud_uri = '//cdn1.lncld.net/static/js/3.11.1/av-min.js' %}
|
||||
{% if theme.vendors.leancloud %}
|
||||
{% set leancloud_uri = theme.vendors.leancloud %}
|
||||
{% endif %}
|
||||
<script src="{{ leancloud_uri }}"></script>
|
||||
|
||||
{% set valine_uri = '//unpkg.com/valine/dist/Valine.min.js' %}
|
||||
{% if theme.vendors.valine %}
|
||||
{% set valine_uri = theme.vendors.valine %}
|
||||
{% endif %}
|
||||
<script src="{{ valine_uri }}"></script>
|
||||
|
||||
<script>
|
||||
var GUEST = ['nick', 'mail', 'link'];
|
||||
var guest = '{{ theme.valine.guest_info }}';
|
||||
guest = guest.split(',').filter(function(item) {
|
||||
return GUEST.indexOf(item) > -1;
|
||||
});
|
||||
new Valine({
|
||||
el: '#comments',
|
||||
verify: {{ theme.valine.verify }},
|
||||
notify: {{ theme.valine.notify }},
|
||||
appId: '{{ theme.valine.appid }}',
|
||||
appKey: '{{ theme.valine.appkey }}',
|
||||
placeholder: '{{ theme.valine.placeholder }}',
|
||||
avatar: '{{ theme.valine.avatar }}',
|
||||
meta: guest,
|
||||
pageSize: '{{ theme.valine.pageSize }}' || 10,
|
||||
visitor: {{ theme.valine.visitor }},
|
||||
lang: '{{ theme.valine.language }}' || 'zh-cn'
|
||||
});
|
||||
</script>
|
36
themes/next/layout/_third-party/copy-code.swig
vendored
Normal file
36
themes/next/layout/_third-party/copy-code.swig
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
{% if theme.codeblock.copy_button.enable %}
|
||||
<script>
|
||||
$('.highlight').not('.gist .highlight').each(function(i, e) {
|
||||
var $wrap = $('<div>').addClass('highlight-wrap');
|
||||
$(e).after($wrap);
|
||||
$wrap.append($('<button>').addClass('copy-btn').append('{{__("post.copy_button")}}').on('click', function(e) {
|
||||
var code = $(this).parent().find('.code').find('.line').map(function(i, e) {
|
||||
return $(e).text();
|
||||
}).toArray().join('\n');
|
||||
var ta = document.createElement('textarea');
|
||||
var yPosition = window.pageYOffset || document.documentElement.scrollTop;
|
||||
ta.style.top = yPosition + 'px'; // Prevent page scroll
|
||||
ta.style.position = 'absolute';
|
||||
ta.style.opacity = '0';
|
||||
ta.readOnly = true;
|
||||
ta.value = code;
|
||||
document.body.appendChild(ta);
|
||||
ta.select();
|
||||
ta.setSelectionRange(0, code.length);
|
||||
ta.readOnly = false;
|
||||
var result = document.execCommand('copy');
|
||||
{% if theme.codeblock.copy_button.show_result %}
|
||||
if (result) $(this).text('{{__("post.copy_success")}}');
|
||||
else $(this).text('{{__("post.copy_failure")}}');
|
||||
{% endif %}
|
||||
ta.blur(); // For iOS
|
||||
$(this).blur();
|
||||
})).on('mouseleave', function(e) {
|
||||
var $b = $(this).find('.copy-btn');
|
||||
setTimeout(function() {
|
||||
$b.text('{{__("post.copy_button")}}');
|
||||
}, 300);
|
||||
}).append(e);
|
||||
})
|
||||
</script>
|
||||
{% endif %}
|
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.enable %}
|
||||
{% set is_index_has_math = false %}
|
||||
|
||||
{# At home, check if there has `mathjax: true` post #}
|
||||
{% if is_home() %}
|
||||
{% for post in page.posts %}
|
||||
{% 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.engine == 'mathjax' %}
|
||||
{% include 'mathjax.swig' %}
|
||||
{% elif theme.math.engine == 'katex' %}
|
||||
{% include 'katex.swig' %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
9
themes/next/layout/_third-party/math/katex.swig
vendored
Normal file
9
themes/next/layout/_third-party/math/katex.swig
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
<link rel="stylesheet" href="{{ theme.math.katex.cdn }}"/>
|
||||
{% if theme.math.katex.copy_tex.enable %}
|
||||
{% if theme.math.katex.copy_tex.copy_tex_js %}
|
||||
<script src="{{ theme.math.katex.copy_tex.copy_tex_js }}"></script>
|
||||
{% endif %}
|
||||
{% if theme.math.katex.copy_tex.copy_tex_css %}
|
||||
<link rel="stylesheet" href="{{ theme.math.katex.copy_tex.copy_tex_css }}"/>
|
||||
{% endif %}
|
||||
{% endif %}
|
40
themes/next/layout/_third-party/math/mathjax.swig
vendored
Normal file
40
themes/next/layout/_third-party/math/mathjax.swig
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
<script type="text/x-mathjax-config">
|
||||
{% if theme.math.mathjax.mhchem %}
|
||||
MathJax.Ajax.config.path['mhchem'] = '{{ theme.math.mathjax.mhchem }}';
|
||||
{% endif %}
|
||||
|
||||
MathJax.Hub.Config({
|
||||
tex2jax: {
|
||||
inlineMath: [ ['$', '$'], ['\\(', '\\)'] ],
|
||||
processEscapes: true,
|
||||
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
|
||||
},
|
||||
TeX: {
|
||||
{% if theme.math.mathjax.mhchem %}
|
||||
extensions: ['[mhchem]/mhchem.js'],
|
||||
{% endif %}
|
||||
equationNumbers: {
|
||||
autoNumber: 'AMS'
|
||||
}
|
||||
}
|
||||
});
|
||||
MathJax.Hub.Register.StartupHook('TeX Jax Ready', function() {
|
||||
MathJax.InputJax.TeX.prefilterHooks.Add(function(data) {
|
||||
if (data.display) {
|
||||
var next = data.script.nextSibling;
|
||||
while (next && next.nodeName.toLowerCase() === '#text') { next = next.nextSibling }
|
||||
if (next && next.nodeName.toLowerCase() === 'br') { next.parentNode.removeChild(next) }
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Queue(function() {
|
||||
var all = MathJax.Hub.getAllJax(), i;
|
||||
for (i = 0; i < all.length; i += 1) {
|
||||
document.getElementById(all[i].inputID + '-Frame').parentNode.className += ' has-jax';
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script src="{{ theme.math.mathjax.cdn }}"></script>
|
21
themes/next/layout/_third-party/mermaid.swig
vendored
Normal file
21
themes/next/layout/_third-party/mermaid.swig
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
{% if theme.mermaid.enable %}
|
||||
<script>
|
||||
if ($('body').find('pre.mermaid').length) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '{{ theme.mermaid.cdn }}',
|
||||
dataType: 'script',
|
||||
cache: true,
|
||||
success: function() {
|
||||
mermaid.initialize({
|
||||
theme: '{{ theme.mermaid.theme }}',
|
||||
logLevel: 3,
|
||||
flowchart: { curve: 'linear' },
|
||||
gantt: { axisFormat: '%m/%d/%Y' },
|
||||
sequence: { actorMargin: 50 }
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{% endif %}
|
23
themes/next/layout/_third-party/needsharebutton.swig
vendored
Normal file
23
themes/next/layout/_third-party/needsharebutton.swig
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
{% if theme.needmoreshare2.enable %}
|
||||
{% set needmoreshare2_js = url_for(theme.vendors._internal + '/needsharebutton/needsharebutton.js') %}
|
||||
{% if theme.vendors.needmoreshare2_js %}
|
||||
{% set needmoreshare2_js = theme.vendors.needmoreshare2_js %}
|
||||
{% endif %}
|
||||
<script src="{{ needmoreshare2_js }}"></script>
|
||||
<script>
|
||||
{% if theme.needmoreshare2.postbottom.enable %}
|
||||
pbOptions = {};
|
||||
{% for k,v in theme.needmoreshare2.postbottom.options %}
|
||||
pbOptions.{{ k }} = "{{ v }}";
|
||||
{% endfor %}
|
||||
new needShareButton('#needsharebutton-postbottom', pbOptions);
|
||||
{% endif %}
|
||||
{% if theme.needmoreshare2.float.enable %}
|
||||
flOptions = {};
|
||||
{% for k,v in theme.needmoreshare2.float.options %}
|
||||
flOptions.{{ k }} = "{{ v }}";
|
||||
{% endfor %}
|
||||
new needShareButton('#needsharebutton-float', flOptions);
|
||||
{% endif %}
|
||||
</script>
|
||||
{% endif %}
|
8
themes/next/layout/_third-party/pangu.swig
vendored
Normal file
8
themes/next/layout/_third-party/pangu.swig
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
{% if theme.pangu %}
|
||||
{% set pangu_uri = url_for(theme.vendors._internal + '/pangu/dist/pangu.min.js?v=3.3') %}
|
||||
{% if theme.vendors.pangu %}
|
||||
{% set pangu_uri = theme.vendors.pangu %}
|
||||
{% endif %}
|
||||
<script src="{{ pangu_uri }}"></script>
|
||||
<script>pangu.spacingPage();</script>
|
||||
{% endif %}
|
27
themes/next/layout/_third-party/pdf.swig
vendored
Normal file
27
themes/next/layout/_third-party/pdf.swig
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
{% if theme.pdf.enable %}
|
||||
<script>
|
||||
if ($('body').find('div.pdf').length) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '{{ theme.pdf.pdfobject.cdn }}',
|
||||
dataType: 'script',
|
||||
cache: true,
|
||||
success: function() {
|
||||
$('body').find('div.pdf').each(function(i, o) {
|
||||
PDFObject.embed($(o).attr('target'), $(o), {
|
||||
pdfOpenParams: {
|
||||
navpanes: 0,
|
||||
toolbar: 0,
|
||||
statusbar: 0,
|
||||
pagemode: 'thumbs',
|
||||
view: 'FitH'
|
||||
},
|
||||
PDFJS_URL: '/lib/pdf/web/viewer.html',
|
||||
height: $(o).attr('height') || '{{ theme.pdf.height }}'
|
||||
});
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{% endif %}
|
35
themes/next/layout/_third-party/quicklink.swig
vendored
Normal file
35
themes/next/layout/_third-party/quicklink.swig
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
{% if theme.quicklink.enable %}
|
||||
{% set quicklink_uri = url_for(theme.vendors._internal + '/quicklink/quicklink.umd.js') %}
|
||||
{% if theme.vendors.quicklink %}
|
||||
{% set quicklink_uri = theme.vendors.quicklink %}
|
||||
{% endif %}
|
||||
|
||||
{% if is_home() %}
|
||||
{% if theme.quicklink.home %}
|
||||
{% set loadQL = true %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if is_archive() %}
|
||||
{% if theme.quicklink.archive %}
|
||||
{% set loadQL = true %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if loadQL or (page.quicklink or post.quicklink) %}
|
||||
<script src="{{ quicklink_uri }}"></script>
|
||||
<script>
|
||||
{% if theme.quicklink.delay %}
|
||||
window.addEventListener('load', () => {
|
||||
{% endif %}
|
||||
quicklink({
|
||||
timeout: {{ theme.quicklink.timeout }},
|
||||
priority: {{ theme.quicklink.priority }},
|
||||
ignores: [uri => uri.includes('#'),uri => uri == '{{ url.replace('index.html', '') }}',{{ theme.quicklink.ignores }}]
|
||||
});
|
||||
{% if theme.quicklink.delay %}
|
||||
});
|
||||
{% endif %}
|
||||
</script>
|
||||
{% endif %}
|
||||
{% endif %}
|
20
themes/next/layout/_third-party/rating.swig
vendored
Normal file
20
themes/next/layout/_third-party/rating.swig
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
{% if theme.rating.enable and (not is_home() and is_post()) %}
|
||||
<script>
|
||||
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 %}
|
171
themes/next/layout/_third-party/schedule.swig
vendored
Normal file
171
themes/next/layout/_third-party/schedule.swig
vendored
Normal file
@ -0,0 +1,171 @@
|
||||
{% if theme.calendar.enable && page.type === 'schedule' %}
|
||||
|
||||
<script>
|
||||
// Initialization
|
||||
function _n(arg) {
|
||||
if (arg) return arg;
|
||||
else return void 0;
|
||||
}
|
||||
|
||||
var now = new Date();
|
||||
var timeMax = new Date();
|
||||
var timeMin = new Date();
|
||||
|
||||
// Read config form theme config file
|
||||
var calId = _n('{{ theme.calendar.calendar_id }}') ;
|
||||
var apiKey = _n('{{ theme.calendar.api_key }}') ;
|
||||
var orderBy = _n('{{ theme.calendar.ordarBy }}') || 'startTime';
|
||||
var showLocation = _n('{{ theme.calendar.showLocation }}') || 'false' ;
|
||||
var offsetMax = _n( {{ theme.calendar.offsetMax }} ) || 72 ;
|
||||
var offsetMin = _n( {{ theme.calendar.offsetMin }} ) || 4 ;
|
||||
var showDeleted = _n( {{ theme.calendar.showDeleted }} ) || 'false' ;
|
||||
var singleEvents = _n( {{ theme.calendar.singleEvents }} ) || 'true' ;
|
||||
var maxResults = _n( {{ theme.calendar.maxResults }} ) || '250' ;
|
||||
|
||||
timeMax.setHours(now.getHours() + offsetMax);
|
||||
timeMin.setHours(now.getHours() - offsetMin);
|
||||
|
||||
// Build URL
|
||||
BASE_URL = 'https://www.googleapis.com/calendar/v3/calendars/';
|
||||
FIELD_KEY = 'key';
|
||||
FIELD_ORDERBY = 'orderBy';
|
||||
FIELD_TIMEMAX = 'timeMax';
|
||||
FIELD_TIMEMIN = 'timeMin';
|
||||
FIELD_SHOWDELETED = 'showDeleted';
|
||||
FIELD_SINGLEEVENTS = 'singleEvents';
|
||||
FIELD_MAXRESULTS = 'maxResults';
|
||||
|
||||
timeMaxISO = timeMax.toISOString();
|
||||
timeMinISO = timeMin.toISOString();
|
||||
|
||||
request_url = BASE_URL + calId + '/events?' +
|
||||
FIELD_KEY + '=' + apiKey + '&' +
|
||||
FIELD_ORDERBY + '=' + orderBy + '&' +
|
||||
FIELD_TIMEMAX + '=' + timeMaxISO + '&' +
|
||||
FIELD_TIMEMIN + '=' + timeMinISO + '&' +
|
||||
FIELD_SHOWDELETED + '=' + showDeleted + '&' +
|
||||
FIELD_SINGLEEVENTS + '=' + singleEvents + '&' +
|
||||
FIELD_MAXRESULTS + '=' + maxResults;
|
||||
|
||||
fetchData();
|
||||
var queryLoop = setInterval(fetchData, 60000);
|
||||
|
||||
function fetchData() {
|
||||
$.ajax({
|
||||
dataType: 'json',
|
||||
url: request_url,
|
||||
success: function(data) {
|
||||
|
||||
$eventList = $('#schedule #event-list');
|
||||
|
||||
// clean the event list
|
||||
$eventList.html('');
|
||||
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.append('<hr/>');
|
||||
|
||||
eventDOM = buildEventDOM(tense, event);
|
||||
$eventList.append(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';
|
||||
}
|
||||
durationFormat = {
|
||||
weekday: 'short',
|
||||
hour : '2-digit',
|
||||
minute : '2-digit'
|
||||
};
|
||||
relativeTimeStr = (tense == 0) ? 'NOW' : getRelativeTime(now, start);
|
||||
durationStr = start.toLocaleTimeString([], durationFormat) + ' - ' +
|
||||
end.toLocaleTimeString([], durationFormat);
|
||||
|
||||
liOpen = '<li class="event ' + tenseClass + '">';
|
||||
liClose = '</li>';
|
||||
h2Open = '<h2 class="event-summary">';
|
||||
h2Close = '</h2>';
|
||||
|
||||
locationDOM = '';
|
||||
if (showLocation && event.location) {
|
||||
locationDOM = '<span class="event-location event-details">' + event.location + '</span>';
|
||||
}
|
||||
relativeTimeDOM = '<span class="event-relative-time">' + relativeTimeStr + '</span>';
|
||||
durationDOM = '<span class="event-duration event-details">' + durationStr + '</span>';
|
||||
|
||||
eventContent =
|
||||
liOpen +
|
||||
h2Open +
|
||||
event.summary +
|
||||
relativeTimeDOM+
|
||||
h2Close +
|
||||
locationDOM +
|
||||
durationDOM +
|
||||
liClose;
|
||||
return eventContent;
|
||||
}
|
||||
</script>
|
||||
|
||||
{% endif %}
|
18
themes/next/layout/_third-party/search/algolia-search.swig
vendored
Normal file
18
themes/next/layout/_third-party/search/algolia-search.swig
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
{% if theme.algolia_search.enable %}
|
||||
|
||||
{# S: Include Algolia instantsearch.js library #}
|
||||
{% set algolia_instant_css = url_for(theme.vendors._internal + '/algolia-instant-search/instantsearch.min.css') %}
|
||||
{% if theme.vendors.algolia_instant_css %}
|
||||
{% set algolia_instant_css = theme.vendors.algolia_instant_css %}
|
||||
{% endif %}
|
||||
<link rel="stylesheet" href="{{ algolia_instant_css }}"/>
|
||||
|
||||
{% set algolia_instant_js = url_for(theme.vendors._internal + '/algolia-instant-search/instantsearch.min.js') %}
|
||||
{% if theme.vendors.algolia_instant_js %}
|
||||
{% set algolia_instant_js = theme.vendors.algolia_instant_js %}
|
||||
{% endif %}
|
||||
<script src="{{ algolia_instant_js }}"></script>
|
||||
{# E: Include Algolia instantsearch.js library #}
|
||||
|
||||
<script src="{{ url_for(theme.js) }}/algolia-search.js?v={{ version }}"></script>
|
||||
{% endif %}
|
2
themes/next/layout/_third-party/search/index.swig
vendored
Normal file
2
themes/next/layout/_third-party/search/index.swig
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
{% include 'localsearch.swig' %}
|
||||
{% include 'algolia-search.swig' %}
|
336
themes/next/layout/_third-party/search/localsearch.swig
vendored
Normal file
336
themes/next/layout/_third-party/search/localsearch.swig
vendored
Normal file
@ -0,0 +1,336 @@
|
||||
{% if theme.local_search.enable %}
|
||||
<script>
|
||||
// Popup Window;
|
||||
var isfetched = false;
|
||||
var isXml = true;
|
||||
// Search DB path;
|
||||
var search_path = "{{ config.search.path }}";
|
||||
if (search_path.length === 0) {
|
||||
search_path = "search.xml";
|
||||
} else if (/json$/i.test(search_path)) {
|
||||
isXml = false;
|
||||
}
|
||||
var path = "{{ config.root }}" + search_path;
|
||||
// monitor main search box;
|
||||
|
||||
var onPopupClose = function (e) {
|
||||
$('.popup').hide();
|
||||
$('#local-search-input').val('');
|
||||
$('.search-result-list').remove();
|
||||
$('#no-result').remove();
|
||||
$(".local-search-pop-overlay").remove();
|
||||
$('body').css('overflow', '');
|
||||
}
|
||||
|
||||
function proceedsearch() {
|
||||
$("body")
|
||||
.append('<div class="search-popup-overlay local-search-pop-overlay"></div>')
|
||||
.css('overflow', 'hidden');
|
||||
$('.search-popup-overlay').click(onPopupClose);
|
||||
$('.popup').toggle();
|
||||
var $localSearchInput = $('#local-search-input');
|
||||
$localSearchInput.attr("autocapitalize", "none");
|
||||
$localSearchInput.attr("autocorrect", "off");
|
||||
$localSearchInput.focus();
|
||||
}
|
||||
|
||||
// search function;
|
||||
var searchFunc = function(path, search_id, content_id) {
|
||||
'use strict';
|
||||
|
||||
// start loading animation
|
||||
$("body")
|
||||
.append('<div class="search-popup-overlay local-search-pop-overlay">' +
|
||||
'<div id="search-loading-icon">' +
|
||||
'<i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>' +
|
||||
'</div>' +
|
||||
'</div>')
|
||||
.css('overflow', 'hidden');
|
||||
$("#search-loading-icon").css('margin', '20% auto 0 auto').css('text-align', 'center');
|
||||
|
||||
{% if theme.local_search.unescape %}
|
||||
// ref: https://github.com/ForbesLindesay/unescape-html
|
||||
var unescapeHtml = function(html) {
|
||||
return String(html)
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, '\'')
|
||||
.replace(/:/g, ':')
|
||||
// replace all the other &#x; chars
|
||||
.replace(/&#(\d+);/g, function (m, p) { return String.fromCharCode(p); })
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/&/g, '&');
|
||||
};
|
||||
{% endif %}
|
||||
|
||||
$.ajax({
|
||||
url: path,
|
||||
dataType: isXml ? "xml" : "json",
|
||||
async: true,
|
||||
success: function(res) {
|
||||
// get the contents from search data
|
||||
isfetched = true;
|
||||
$('.popup').detach().appendTo('.header-inner');
|
||||
var datas = isXml ? $("entry", res).map(function() {
|
||||
return {
|
||||
title: $("title", this).text(),
|
||||
content: $("content",this).text(),
|
||||
url: $("url" , this).text()
|
||||
};
|
||||
}).get() : res;
|
||||
var input = document.getElementById(search_id);
|
||||
var resultContent = document.getElementById(content_id);
|
||||
var inputEventFunction = function() {
|
||||
var searchText = input.value.trim().toLowerCase();
|
||||
var keywords = searchText.split(/[\s\-]+/);
|
||||
if (keywords.length > 1) {
|
||||
keywords.push(searchText);
|
||||
}
|
||||
var resultItems = [];
|
||||
if (searchText.length > 0) {
|
||||
// perform local searching
|
||||
datas.forEach(function(data) {
|
||||
var isMatch = false;
|
||||
var hitCount = 0;
|
||||
var searchTextCount = 0;
|
||||
var title = data.title.trim();
|
||||
var titleInLowerCase = title.toLowerCase();
|
||||
var content = data.content.trim().replace(/<[^>]+>/g,"");
|
||||
{% if theme.local_search.unescape %}
|
||||
content = unescapeHtml(content);
|
||||
{% endif %}
|
||||
var contentInLowerCase = content.toLowerCase();
|
||||
var articleUrl = decodeURIComponent(data.url).replace(/\/{2,}/g, '/');
|
||||
var indexOfTitle = [];
|
||||
var indexOfContent = [];
|
||||
// only match articles with not empty titles
|
||||
if(title != '') {
|
||||
keywords.forEach(function(keyword) {
|
||||
function getIndexByWord(word, text, caseSensitive) {
|
||||
var wordLen = word.length;
|
||||
if (wordLen === 0) {
|
||||
return [];
|
||||
}
|
||||
var startPosition = 0, position = [], index = [];
|
||||
if (!caseSensitive) {
|
||||
text = text.toLowerCase();
|
||||
word = word.toLowerCase();
|
||||
}
|
||||
while ((position = text.indexOf(word, startPosition)) > -1) {
|
||||
index.push({position: position, word: word});
|
||||
startPosition = position + wordLen;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
indexOfTitle = indexOfTitle.concat(getIndexByWord(keyword, titleInLowerCase, false));
|
||||
indexOfContent = indexOfContent.concat(getIndexByWord(keyword, contentInLowerCase, false));
|
||||
});
|
||||
if (indexOfTitle.length > 0 || indexOfContent.length > 0) {
|
||||
isMatch = true;
|
||||
hitCount = indexOfTitle.length + indexOfContent.length;
|
||||
}
|
||||
}
|
||||
|
||||
// show search results
|
||||
|
||||
if (isMatch) {
|
||||
// sort index by position of keyword
|
||||
|
||||
[indexOfTitle, indexOfContent].forEach(function (index) {
|
||||
index.sort(function (itemLeft, itemRight) {
|
||||
if (itemRight.position !== itemLeft.position) {
|
||||
return itemRight.position - itemLeft.position;
|
||||
} else {
|
||||
return itemLeft.word.length - itemRight.word.length;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// merge hits into slices
|
||||
|
||||
function mergeIntoSlice(text, start, end, index) {
|
||||
var item = index[index.length - 1];
|
||||
var position = item.position;
|
||||
var word = item.word;
|
||||
var hits = [];
|
||||
var searchTextCountInSlice = 0;
|
||||
while (position + word.length <= end && index.length != 0) {
|
||||
if (word === searchText) {
|
||||
searchTextCountInSlice++;
|
||||
}
|
||||
hits.push({position: position, length: word.length});
|
||||
var wordEnd = position + word.length;
|
||||
|
||||
// move to next position of hit
|
||||
|
||||
index.pop();
|
||||
while (index.length != 0) {
|
||||
item = index[index.length - 1];
|
||||
position = item.position;
|
||||
word = item.word;
|
||||
if (wordEnd > position) {
|
||||
index.pop();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
searchTextCount += searchTextCountInSlice;
|
||||
return {
|
||||
hits: hits,
|
||||
start: start,
|
||||
end: end,
|
||||
searchTextCount: searchTextCountInSlice
|
||||
};
|
||||
}
|
||||
|
||||
var slicesOfTitle = [];
|
||||
if (indexOfTitle.length != 0) {
|
||||
slicesOfTitle.push(mergeIntoSlice(title, 0, title.length, indexOfTitle));
|
||||
}
|
||||
|
||||
var slicesOfContent = [];
|
||||
while (indexOfContent.length != 0) {
|
||||
var item = indexOfContent[indexOfContent.length - 1];
|
||||
var position = item.position;
|
||||
var word = item.word;
|
||||
// cut out 100 characters
|
||||
var start = position - 20;
|
||||
var end = position + 80;
|
||||
if(start < 0){
|
||||
start = 0;
|
||||
}
|
||||
if (end < position + word.length) {
|
||||
end = position + word.length;
|
||||
}
|
||||
if(end > content.length){
|
||||
end = content.length;
|
||||
}
|
||||
slicesOfContent.push(mergeIntoSlice(content, start, end, indexOfContent));
|
||||
}
|
||||
|
||||
// sort slices in content by search text's count and hits' count
|
||||
|
||||
slicesOfContent.sort(function (sliceLeft, sliceRight) {
|
||||
if (sliceLeft.searchTextCount !== sliceRight.searchTextCount) {
|
||||
return sliceRight.searchTextCount - sliceLeft.searchTextCount;
|
||||
} else if (sliceLeft.hits.length !== sliceRight.hits.length) {
|
||||
return sliceRight.hits.length - sliceLeft.hits.length;
|
||||
} else {
|
||||
return sliceLeft.start - sliceRight.start;
|
||||
}
|
||||
});
|
||||
|
||||
// select top N slices in content
|
||||
|
||||
var upperBound = parseInt('{{ theme.local_search.top_n_per_article }}');
|
||||
if (upperBound >= 0) {
|
||||
slicesOfContent = slicesOfContent.slice(0, upperBound);
|
||||
}
|
||||
|
||||
// highlight title and content
|
||||
|
||||
function highlightKeyword(text, slice) {
|
||||
var result = '';
|
||||
var prevEnd = slice.start;
|
||||
slice.hits.forEach(function (hit) {
|
||||
result += text.substring(prevEnd, hit.position);
|
||||
var end = hit.position + hit.length;
|
||||
result += '<b class="search-keyword">' + text.substring(hit.position, end) + '</b>';
|
||||
prevEnd = end;
|
||||
});
|
||||
result += text.substring(prevEnd, slice.end);
|
||||
return result;
|
||||
}
|
||||
|
||||
var resultItem = '';
|
||||
|
||||
if (slicesOfTitle.length != 0) {
|
||||
resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + highlightKeyword(title, slicesOfTitle[0]) + "</a>";
|
||||
} else {
|
||||
resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + title + "</a>";
|
||||
}
|
||||
|
||||
slicesOfContent.forEach(function (slice) {
|
||||
resultItem += "<a href='" + articleUrl + "'>" +
|
||||
"<p class=\"search-result\">" + highlightKeyword(content, slice) +
|
||||
"...</p>" + "</a>";
|
||||
});
|
||||
|
||||
resultItem += "</li>";
|
||||
resultItems.push({
|
||||
item: resultItem,
|
||||
searchTextCount: searchTextCount,
|
||||
hitCount: hitCount,
|
||||
id: resultItems.length
|
||||
});
|
||||
}
|
||||
})
|
||||
};
|
||||
if (keywords.length === 1 && keywords[0] === "") {
|
||||
resultContent.innerHTML = '<div id="no-result"><i class="fa fa-search fa-5x"></i></div>'
|
||||
} else if (resultItems.length === 0) {
|
||||
resultContent.innerHTML = '<div id="no-result"><i class="fa fa-frown-o fa-5x"></i></div>'
|
||||
} else {
|
||||
resultItems.sort(function (resultLeft, resultRight) {
|
||||
if (resultLeft.searchTextCount !== resultRight.searchTextCount) {
|
||||
return resultRight.searchTextCount - resultLeft.searchTextCount;
|
||||
} else if (resultLeft.hitCount !== resultRight.hitCount) {
|
||||
return resultRight.hitCount - resultLeft.hitCount;
|
||||
} else {
|
||||
return resultRight.id - resultLeft.id;
|
||||
}
|
||||
});
|
||||
var searchResultList = '<ul class=\"search-result-list\">';
|
||||
resultItems.forEach(function (result) {
|
||||
searchResultList += result.item;
|
||||
})
|
||||
searchResultList += "</ul>";
|
||||
resultContent.innerHTML = searchResultList;
|
||||
}
|
||||
}
|
||||
|
||||
if ('auto' === '{{ theme.local_search.trigger }}') {
|
||||
input.addEventListener('input', inputEventFunction);
|
||||
} else {
|
||||
$('.search-icon').click(inputEventFunction);
|
||||
input.addEventListener('keypress', function (event) {
|
||||
if (event.keyCode === 13) {
|
||||
inputEventFunction();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// remove loading animation
|
||||
$(".local-search-pop-overlay").remove();
|
||||
$('body').css('overflow', '');
|
||||
|
||||
proceedsearch();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// handle and trigger popup window;
|
||||
$('.popup-trigger').click(function(e) {
|
||||
e.stopPropagation();
|
||||
if (isfetched === false) {
|
||||
searchFunc(path, 'local-search-input', 'local-search-result');
|
||||
} else {
|
||||
proceedsearch();
|
||||
};
|
||||
});
|
||||
|
||||
$('.popup-btn-close').click(onPopupClose);
|
||||
$('.popup').click(function(e){
|
||||
e.stopPropagation();
|
||||
});
|
||||
$(document).on('keyup', function (event) {
|
||||
var shouldDismissSearchPopup = event.which === 27 &&
|
||||
$('.search-popup').is(':visible');
|
||||
if (shouldDismissSearchPopup) {
|
||||
onPopupClose();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endif %}
|
3
themes/next/layout/_third-party/tidio.swig
vendored
Normal file
3
themes/next/layout/_third-party/tidio.swig
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{% if theme.tidio.enable %}
|
||||
<script src="//code.tidio.co/{{ theme.tidio.key }}.js"></script>
|
||||
{% endif %}
|
64
themes/next/layout/archive.swig
Normal file
64
themes/next/layout/archive.swig
Normal file
@ -0,0 +1,64 @@
|
||||
{% extends '_layout.swig' %}
|
||||
{% import '_macro/post-collapse.swig' as post_template %}
|
||||
{% import '_macro/sidebar.swig' as sidebar_template %}
|
||||
|
||||
{% block title %}{{ __('title.archive') }} | {{ title }}{% endblock %}
|
||||
|
||||
{% block page_class %}page-archive{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{#####################}
|
||||
{### ARCHIVE BLOCK ###}
|
||||
{#####################}
|
||||
<div class="post-block archive">
|
||||
<div id="posts" class="posts-collapse">
|
||||
<span class="archive-move-on"></span>
|
||||
|
||||
{% if theme.cheers %}
|
||||
<span class="archive-page-counter">
|
||||
{% set cheers %}
|
||||
{% 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 %}
|
||||
{{ __('cheers.' + cheers) }}! {{ _p("counter.archive_posts", site.posts.length) }} {{ __('keep_on') }}
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
{% for post in page.posts %}
|
||||
|
||||
{# Show year #}
|
||||
{% set year %}
|
||||
{% set post.year = date(post.date, 'YYYY') %}
|
||||
|
||||
{% if post.year !== year %}
|
||||
{% set year = post.year %}
|
||||
<div class="collection-title">
|
||||
<{% if theme.seo %}h2{% else %}h1{% endif %} class="archive-year" id="archive-year-{{ year }}">{{ year }}</{% if theme.seo %}h2{% else %}h1{% endif %}>
|
||||
</div>
|
||||
{% endif %}
|
||||
{# endshow #}
|
||||
|
||||
{{ post_template.render(post) }}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{#########################}
|
||||
{### END ARCHIVE BLOCK ###}
|
||||
{#########################}
|
||||
|
||||
{% include '_partials/pagination.swig' %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block sidebar %}
|
||||
{{ sidebar_template.render(false) }}
|
||||
{% endblock %}
|
38
themes/next/layout/category.swig
Normal file
38
themes/next/layout/category.swig
Normal file
@ -0,0 +1,38 @@
|
||||
{% extends '_layout.swig' %}
|
||||
{% import '_macro/post-collapse.swig' as post_template %}
|
||||
{% import '_macro/sidebar.swig' as sidebar_template %}
|
||||
|
||||
{% block title %}{{ __('title.category') }}: {{ page.category }} | {{ title }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{######################}
|
||||
{### CATEGORY BLOCK ###}
|
||||
{######################}
|
||||
<div class="post-block category">
|
||||
|
||||
<div id="posts" class="posts-collapse">
|
||||
<div class="collection-title">
|
||||
<{% if theme.seo %}h2{% else %}h1{% endif %}>{#
|
||||
#}{{ page.category }}{#
|
||||
#}<small>{{ __('title.category') }}</small>
|
||||
</{% if theme.seo %}h2{% else %}h1{% endif %}>
|
||||
</div>
|
||||
|
||||
{% for post in page.posts %}
|
||||
{{ post_template.render(post) }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{##########################}
|
||||
{### END CATEGORY BLOCK ###}
|
||||
{##########################}
|
||||
|
||||
{% include '_partials/pagination.swig' %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block sidebar %}
|
||||
{{ sidebar_template.render(false) }}
|
||||
{% endblock %}
|
23
themes/next/layout/index.swig
Normal file
23
themes/next/layout/index.swig
Normal file
@ -0,0 +1,23 @@
|
||||
{% extends '_layout.swig' %}
|
||||
{% import '_macro/post.swig' as post_template %}
|
||||
{% import '_macro/sidebar.swig' as sidebar_template %}
|
||||
|
||||
{% block title %}{{ title }}{% if theme.index_with_subtitle and subtitle %} – {{ subtitle }}{% endif %}{% endblock %}
|
||||
|
||||
{% block page_class %}
|
||||
{% if is_home() %}page-home{% endif -%}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<section id="posts" class="posts-expand">
|
||||
{% for post in page.posts %}
|
||||
{{ post_template.render(post, true) }}
|
||||
{% endfor %}
|
||||
</section>
|
||||
|
||||
{% include '_partials/pagination.swig' %}
|
||||
{% endblock %}
|
||||
|
||||
{% block sidebar %}
|
||||
{{ sidebar_template.render(false) }}
|
||||
{% endblock %}
|
91
themes/next/layout/page.swig
Normal file
91
themes/next/layout/page.swig
Normal file
@ -0,0 +1,91 @@
|
||||
{% extends '_layout.swig' %}
|
||||
{% import '_macro/sidebar.swig' as sidebar_template %}
|
||||
|
||||
{% 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 page_class %}page-post-detail{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div id="posts" class="posts-expand">
|
||||
{##################}
|
||||
{### PAGE BLOCK ###}
|
||||
{##################}
|
||||
<div class="post-block page">
|
||||
{% include '_partials/page/page-header.swig' %}
|
||||
{#################}
|
||||
{### PAGE BODY ###}
|
||||
{#################}
|
||||
<div class="post-body{% if theme.han %} han-init-context{% endif %}{% if page.direction && page.direction.toLowerCase() === 'rtl' %} rtl{% endif %}">
|
||||
{# tagcloud page support #}
|
||||
{% if page.type === 'tags' %}
|
||||
<div class="tag-cloud">
|
||||
<div class="tag-cloud-title">
|
||||
{% set visibleTags = 0 %}
|
||||
{% for tag in site.tags %}
|
||||
{% if tag.length %}
|
||||
{% set visibleTags += 1 %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ _p('counter.tag_cloud', visibleTags) }}
|
||||
</div>
|
||||
<div class="tag-cloud-tags">
|
||||
{% if not theme.tagcloud %}
|
||||
{{ tagcloud({min_font: 12, max_font: 30, amount: 200, color: true, start_color: '#ccc', end_color: '#111'}) }}
|
||||
{% else %}
|
||||
{{ 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}) }}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% elif page.type === 'categories' %}
|
||||
<div class="category-all-page">
|
||||
<div class="category-all-title">
|
||||
{% set visibleCategories = 0 %}
|
||||
{% for cat in site.categories %}
|
||||
{% if cat.length %}
|
||||
{% set visibleCategories += 1 %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ _p('counter.categories', visibleCategories) }}
|
||||
</div>
|
||||
<div class="category-all">
|
||||
{{ list_categories() }}
|
||||
</div>
|
||||
</div>
|
||||
{% elif page.type === 'schedule' %}
|
||||
{% include 'schedule.swig' %}
|
||||
{% else %}
|
||||
{{ page.content }}
|
||||
{% endif %}
|
||||
</div>
|
||||
{#####################}
|
||||
{### END PAGE BODY ###}
|
||||
{#####################}
|
||||
</div>
|
||||
{% include '_partials/page/breadcrumb.swig' %}
|
||||
{######################}
|
||||
{### END PAGE BLOCK ###}
|
||||
{######################}
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block sidebar %}
|
||||
{{ sidebar_template.render(false) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block script_extra %}
|
||||
{% include '_scripts/pages/post-details.swig' %}
|
||||
{% endblock %}
|
23
themes/next/layout/post.swig
Normal file
23
themes/next/layout/post.swig
Normal file
@ -0,0 +1,23 @@
|
||||
{% extends '_layout.swig' %}
|
||||
{% import '_macro/post.swig' as post_template %}
|
||||
{% import '_macro/sidebar.swig' as sidebar_template %}
|
||||
|
||||
{% block title %}{{ page.title }} | {{ title }}{% endblock %}
|
||||
|
||||
{% block page_class %}page-post-detail{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div id="posts" class="posts-expand">
|
||||
{{ post_template.render(page) }}
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block sidebar %}
|
||||
{{ sidebar_template.render(true) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block script_extra %}
|
||||
{% include '_scripts/pages/post-details.swig' %}
|
||||
{% endblock %}
|
14
themes/next/layout/schedule.swig
Normal file
14
themes/next/layout/schedule.swig
Normal file
@ -0,0 +1,14 @@
|
||||
{% block content %}
|
||||
{######################}
|
||||
{### SCHEDULE BLOCK ###}
|
||||
{######################}
|
||||
<div class="post-block schedule">
|
||||
<div id="schedule">
|
||||
<ul id="event-list">
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{##########################}
|
||||
{### END SCHEDULE BLOCK ###}
|
||||
{##########################}
|
||||
{% endblock %}
|
38
themes/next/layout/tag.swig
Normal file
38
themes/next/layout/tag.swig
Normal file
@ -0,0 +1,38 @@
|
||||
{% extends '_layout.swig' %}
|
||||
{% import '_macro/post-collapse.swig' as post_template %}
|
||||
{% import '_macro/sidebar.swig' as sidebar_template %}
|
||||
|
||||
{% block title %}{{ __('title.tag') }}: {{ page.tag }} | {{ title }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{#################}
|
||||
{### TAG BLOCK ###}
|
||||
{#################}
|
||||
<div class="post-block tag">
|
||||
|
||||
<div id="posts" class="posts-collapse">
|
||||
<div class="collection-title">
|
||||
<{% if theme.seo %}h2{% else %}h1{% endif %}>{#
|
||||
#}{{ page.tag }}{#
|
||||
#}<small>{{ __('title.tag') }}</small>
|
||||
</{% if theme.seo %}h2{% else %}h1{% endif %}>
|
||||
</div>
|
||||
|
||||
{% for post in page.posts %}
|
||||
{{ post_template.render(post) }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{#####################}
|
||||
{### END TAG BLOCK ###}
|
||||
{#####################}
|
||||
|
||||
{% include '_partials/pagination.swig' %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block sidebar %}
|
||||
{{ sidebar_template.render(false) }}
|
||||
{% endblock %}
|
Reference in New Issue
Block a user