<%# Body尾部的脚本加载顺序 %>
<script>
  <% if (theme.plugins.fontawesome) { %>
  volantis.css("<%- theme.cdn.fontawesome %>");
  <% } %>
  <% if (theme.plugins.fontawesome_animation.enable) { %>
  volantis.css("<%- theme.cdn['font-awesome-animation'] %>");
  <% } %>
  <% if (theme.plugins.nodewaves.enable) { %>
  volantis.css("<%- theme.cdn.nodewaves_css %>");
  <% } %>
</script>

<!-- required -->
<% if (theme.plugins.globalJquery) { %>
  <%- js(theme.cdn.jquery) %>
<% } %>

<!-- internal -->
<!-- 这里不能使用 Hexo 内置的 helper: js(theme.cdn.volantis_app) ， 会导致多加一个 config.site_root -->
<script src="<%- theme.cdn.volantis_app %>"></script>


<% if (theme.rightmenus.enable) { %>
  <%- partial('../_plugins/rightmenus/layout') %>
<% } %>

<!-- rightmenu要在darkmode之前（ToggleButton） darkmode要在comments之前（volantis.dark.push）-->
<% if (theme.plugins.darkmode.enable) { %>
  <%- partial('../_plugins/darkmode/script') %>
<% } %>

<% if (theme.plugins.sitesjs.enable || theme.plugins.friendsjs.enable || theme.plugins.contributorsjs.enable) { %>
<%- partial('../_plugins/github-api/script') %>
<% } %>

<%- partial('../_plugins/data-service-api/script') %>

<% if (theme.plugins.lazyload && theme.plugins.lazyload.enable) { %>
  <%- partial('../_plugins/lazyload/script') %>
<% } %>

<% if (theme.plugins.preload.enable && theme.plugins.preload.service) { %>
  <%- partial('../_plugins/preload/script') %>
<% } %>

<% if (theme.plugins.scrollreveal.enable) { %>
   <%- partial('../_plugins/scrollreveal/script') %>
<% } %>

<% if (theme.plugins.aplayer && theme.plugins.aplayer.enable) { %>
  <% if (!is_post() && !is_page()) { %>
    <%- partial('../_plugins/aplayer/script') %>
    <% if (theme.plugins.aplayer.fixed == true ) { %>
      <%- partial('../_plugins/aplayer/layout', { post: page }) %>
    <% } %>
  <% } %>
  <% if (is_post() || is_page()) { %>
    <%- partial('../_plugins/aplayer/script') %>
    <% if (!page.music && theme.plugins.aplayer.fixed == true ) { %>
        <%- partial('../_plugins/aplayer/layout', { post: page }) %>
    <% } %>
  <% } %>
<% } %>

<%
  if (theme.comments.service && theme.comments.service.length > 0) {
    try { %>
      <%- partial('../_plugins/comments/' + theme.comments.service + '/script') %>
    <% } catch (e) {
      // error friendly
      console.log(`
===============================================================================
    没有找到评论插件：${theme.comments.service}
    请检查是否存在该插件，或者检查插件名称是否正确：${theme.comments.service}
    see: https://volantis.js.org/v6/theme-settings/#选择评论系统
================================================================================
    There is no comments plugin: ${theme.comments.service}
    Please check if the plugin exists, or check the plugin name is correct: ${theme.comments.service}
    see: https://volantis.js.org/v6/theme-settings/#选择评论系统
=================================================================================`)
    }
  }
%>



<% if (theme.plugins.busuanzi.enable) { %>
  <script defer src="<%- theme.cdn.busuanzi %>" data-pjax></script>
<% } %>

<!-- optional -->
<% if (theme.search && theme.search.enable) { %>
  <%- partial('../_plugins/search/script') %>
<% } %>

<% if (theme.plugins.nodewaves.enable) { %>
  <%- partial('../_plugins/nodewaves/script') %>
<% } %>

<% if (theme.plugins.comment_typing.enable) { %>
  <%- js(theme.cdn.comment_typing) %>
<% } %>

<% if (theme.plugins.code_highlight) { %>
  <%- partial('../_plugins/highlight/script') %>
<% } %>

<% if (config.google_analytics_key || config.baidu_analytics_key || config.tencent_aegis_id || config.v6_51_la || config.perf_51_la) { %>
  <%- partial('../_plugins/analytics/script') %>
<% } %>

<% if (theme.plugins.chat_service) { %>
  <%- partial('../_plugins/chat/index') %>
<% } %>

<% if (theme.plugins.parallax.enable) { %>
  <%- partial('../_plugins/parallax/script') %>
<% } %>

<% if (theme.plugins.swiper.enable) { %>
  <%- partial('../_plugins/swiper/script') %>
<% } %>

<% if (theme.plugins.pace.enable) { %>
  <%- partial('../_plugins/pace/script') %>
<% } %>

<% if (theme.plugins.nprogress && theme.plugins.nprogress.enable){ %>
  <%- partial('../_plugins/nprogress/index') %>
<% } %>


<!-- pjax -->
<% if (theme.plugins.pjax.enable){ %>
  <%- partial('../_plugins/pjax/index') %>
<% } %>

<!-- pjax 标签必须存在于所有页面 否则 pjax error -->
<pjax>
<% if (page.plugins) { %>
<%- partial('../_plugins/_page_plugins/index') %>
<% } %>
</pjax>

<%- partial('../_plugins/toc/script') %>

<% if (theme.content_visibility) { %>
  <%- partial('../_plugins/content-visibility/script') %>
<% } %>

<%- partial('../_plugins/slow-network/script') %>


<% if (theme.plugins.tianliGPT.enable) { %>
  <%- partial('../_plugins/tianligpt/script') %>
<% } %>



