<%- partial('_partial/plugins/nprogress.ejs') %>
<%- js_ex(theme.static_prefix.jquery, 'jquery.min.js') %>
<%- js_ex(theme.static_prefix.bootstrap, 'js/bootstrap.min.js') %>
<%- js_ex(theme.static_prefix.internal_js, 'debouncer.js') %>
<%- js_ex(theme.static_prefix.internal_js, 'events.js') %>
<%- js_ex(theme.static_prefix.internal_js, 'plugins.js') %>

<!-- Plugins -->

<% if (theme.lazyload.enable){ %>
  <% if (theme.lazyload.onlypost) { %>
    <% if (is_post() || is_page()) { %>
      <%- js_ex(theme.static_prefix.internal_js, 'lazyload.js') %>
    <% } %>
  <% } else { %>
    <%- js_ex(theme.static_prefix.internal_js, 'lazyload.js') %>
  <% } %>
<% } %>

<% if (theme.code.highlight.enable) { %>
  <% if (theme.code.highlight.lib === 'prismjs') { %>
    <% if (!theme.code.highlight.prismjs.preprocess) { %>
      <%- js_ex(theme.static_prefix.prismjs, 'components/prism-core.min.js') %>
      <%- js_ex(theme.static_prefix.prismjs, 'plugins/autoloader/prism-autoloader.min.js') %>
      <% if (theme.code.highlight.line_number) { %>
        <%- js_ex(theme.static_prefix.prismjs, '/plugins/line-numbers/prism-line-numbers.min.js') %>
      <% } %>
    <% } %>
  <% } %>
<% } %>

<% if(is_post() && theme.post.toc.enable && page.toc !== false) { %>
  <%- js_ex(theme.static_prefix.tocbot, 'tocbot.min.js') %>
<% } %>

<% if ((is_post() || (is_page() && page.image_zoom)) && theme.post.image_zoom.enable) { %>
  <%- js_ex(theme.static_prefix.fancybox, 'jquery.fancybox.min.js') %>
<% } %>

<% if((is_post() || is_page()) && theme.fun_features.anchorjs.enable){ %>
  <%- js_ex(theme.static_prefix.anchor, 'anchor.min.js') %>
<% } %>

<% if (theme.code.copy_btn) { %>
  <%- js_ex(theme.static_prefix.clipboard, 'clipboard.min.js', 'defer') %>
<% } %>

<% if ((theme.footer.statistics.enable && theme.footer.statistics.source === 'busuanzi')
  || (page.meta !== false && theme.post.meta.views.enable && theme.post.meta.views.source === 'busuanzi')) { %>
  <%- js_ex(theme.static_prefix.busuanzi, 'busuanzi.pure.mini.js', 'defer') %>
<% } %>
<% if (theme.web_analytics.enable && theme.web_analytics.leancloud.app_id && theme.web_analytics.leancloud.app_key) { %>
  <%- js_ex(theme.static_prefix.internal_js, 'leancloud.js', 'defer') %>
<% } else if (theme.web_analytics.leancloud.app_id && theme.web_analytics.leancloud.app_key &&
  ((theme.footer.statistics.enable && theme.footer.statistics.source === 'leancloud')
    || (page.meta !== false && theme.post.meta.views.enable && theme.post.meta.views.source === 'leancloud'))) { %>
  <%- js_ex(theme.static_prefix.internal_js, 'leancloud.js', 'defer') %>
<% } %>

<%- partial('_partial/plugins/typed.ejs') %>
<%- partial('_partial/plugins/local-search.ejs') %>
<%- partial('_partial/plugins/math.ejs') %>
<%- partial('_partial/plugins/mermaid.ejs') %>
<%- partial('_partial/plugins/analytics.ejs') %>

<% if (theme.custom_js) { %>
  <%- js(theme.custom_js) %>
<% } %>

<!-- 主题的启动项 保持在最底部 -->
<%- js_ex(theme.static_prefix.internal_js, 'boot.js') %>
