You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

175 lines
5.9 KiB

5 years ago
<script src="https://cdn.jsdelivr.net/npm/jquery@3.3.1/dist/jquery.min.js"></script>
6 years ago
<% if (theme.search && theme.search.enable) { %>
<script>
var GOOGLE_CUSTOM_SEARCH_API_KEY = "<%- theme.search.google_api_key %>";
var GOOGLE_CUSTOM_SEARCH_ENGINE_ID = "<%- theme.search.google_engine_id %>";
var ALGOLIA_API_KEY = "<%- theme.search.algolia_api_key %>";
var ALGOLIA_APP_ID = "<%- theme.search.algolia_app_id %>";
var ALGOLIA_INDEX_NAME = "<%- theme.search.algolia_index_name %>";
var AZURE_SERVICE_NAME = "<%- theme.search.azure_service_name %>";
var AZURE_INDEX_NAME = "<%- theme.search.azure_index_name %>";
var AZURE_QUERY_KEY = "<%- theme.search.azure_query_key %>";
var BAIDU_API_ID = "<%- theme.search.baidu_api_id %>";
var SEARCH_SERVICE = "<%- theme.search.service%>" || "hexo";
var ROOT = "<%- config.root %>"||"/";
if(!ROOT.endsWith('/'))ROOT += '/';
</script>
<% } %>
5 years ago
5 years ago
<% if (theme.scrollreveal == true) { %>
5 years ago
<script async src="https://cdn.jsdelivr.net/npm/scrollreveal@4.0.5/dist/scrollreveal.min.js"></script>
<script type="text/javascript">
$(function() {
const $reveal = $('.reveal');
if ($reveal.length === 0) return;
const sr = ScrollReveal({ distance: 0 });
sr.reveal('.reveal');
});
</script>
<% } %>
5 years ago
<% if (theme.nodewaves == true) { %>
5 years ago
<script src="https://cdn.jsdelivr.net/npm/node-waves@0.7.6/dist/waves.min.js"></script>
<script type="text/javascript">
$(function() {
Waves.attach('.flat-btn', ['waves-button']);
Waves.attach('.float-btn', ['waves-button', 'waves-float']);
Waves.attach('.float-btn-light', ['waves-button', 'waves-float', 'waves-light']);
Waves.attach('.flat-box', ['waves-block']);
Waves.attach('.float-box', ['waves-block', 'waves-float']);
Waves.attach('.waves-image');
Waves.init();
});
</script>
<% } %>
5 years ago
<% if (theme.busuanzi == true) { %>
5 years ago
<script async src="https://cdn.jsdelivr.net/gh/xaoxuu/cdn-busuanzi@2.3/js/busuanzi.pure.mini.js"></script>
<% } %>
5 years ago
<% if (theme.fastclick == true) { %>
5 years ago
<!-- fastclick -->
<script src="https://cdn.jsdelivr.net/npm/fastclick@1.0.6/lib/fastclick.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
FastClick.attach(document.body)
}, false)
</script>
<% } %>
5 years ago
6 years ago
5 years ago
<%
var enableDisqus = false;
var enableLivere = false;
var enableValine = false;
5 years ago
if (page && page.comments != false) {
5 years ago
if (config.disqus_shortname) {
enableDisqus = true;
6 years ago
}
5 years ago
if (config.livere_uid) {
enableLivere = true;
}
5 years ago
if (theme.valine && theme.valine.enable && config.leancloud) {
5 years ago
enableValine = true;
}
}
%>
<% if (enableDisqus){ %>
<script>
var disqus_shortname = '<%= config.disqus_shortname %>';
<% if (page.permalink){ %>
var disqus_url = '<%= page.permalink %>';
<% } %>
(function(){
var dsq = document.createElement('script');
dsq.type = 'text/javascript';
dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/<% if (page.comments) { %>embed.js<% } else { %>count.js<% } %>';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<% } %>
<% if (enableLivere){ %>
<script type="text/javascript">
(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>
<% } %>
<% if (enableValine){ %>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
5 years ago
<% if (theme.valine.volantis == true) { %>
5 years ago
<% if (theme.info && theme.info.cdn && theme.info.cdn.js && theme.info.cdn.js.volantis) { %>
<%- js(theme.info.cdn.js.volantis) %>
5 years ago
<% } else { %>
5 years ago
<%- js(['js/volantis.js']) %>
6 years ago
<% } %>
5 years ago
<% } else { %>
<script src="https://cdn.jsdelivr.net/gh/xaoxuu/cdn-valine@1.3.4/js/valine.min.js"></script>
6 years ago
<% } %>
5 years ago
<script>
var GUEST_INFO = ['nick','mail','link'];
5 years ago
var guest_info = '<%= theme.valine.guest_info %>'.split(',').filter(function(item){
5 years ago
return GUEST_INFO.indexOf(item) > -1
});
5 years ago
var notify = '<%= theme.valine.notify %>' == true;
var verify = '<%= theme.valine.verify %>' == true;
5 years ago
var valine = new Valine();
valine.init({
el: '#valine_container',
notify: notify,
verify: verify,
guest_info: guest_info,
<% if(page.valine && page.valine.path) { %>
path: "<%= page.valine.path %>",
<% } %>
5 years ago
appId: "<%= config.leancloud.app_id %>",
appKey: "<%= config.leancloud.app_key %>",
placeholder: "<%= (page.valine && page.valine.placeholder) ? page.valine.placeholder : theme.valine.placeholder %>",
pageSize:'<%= theme.valine.pageSize %>',
avatar:'<%= theme.valine.avatar %>',
lang:'<%= theme.valine.lang %>',
highlight:'<%= theme.valine.highlight %>'
5 years ago
})
</script>
<% } %>
5 years ago
<% if (theme.info && theme.info.cdn && theme.info.cdn.js && theme.info.cdn.js.app) { %>
<%- js(theme.info.cdn.js.app) %>
5 years ago
<% } else { %>
5 years ago
<%- js(['js/app.js']) %>
<% } %>
<% if (theme.info && theme.info.cdn && theme.info.cdn.js && theme.info.cdn.js.search) { %>
<%- js(theme.info.cdn.js.search) %>
<% } else { %>
<%- js(['js/search.js']) %>
6 years ago
<% } %>
5 years ago
6 years ago
<% if (page.layout == 'links') { %>
<%- js('https://cdn.jsdelivr.net/gh/toddmotto/echo@1.7.3/src/echo.js') %>
<script>
echo.init({
offset: 100,
throttle: 250,
unload: false,
callback: function (element, op) {
5 years ago
// console.log(element, 'has been', op + 'ed');
6 years ago
}
});
</script>
<% } %>
5 years ago
5 years ago
<!-- 复制 -->
<%- partial('_third-party/clipboard') %>
<!-- fancybox -->
<%- partial('_third-party/fancybox') %>
5 years ago
<% if (config.import && config.import.script){ %>
<% (config.import.script||[]).forEach(function(item){ %>
<%- item %><% }) %>
5 years ago
<% } %>