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.
224 lines
7.7 KiB
224 lines
7.7 KiB
<%- js(theme.plugins.jquery) %> |
|
<% if (theme.search && theme.search.enable) { %> |
|
<script> |
|
<% if(theme.search.service === 'baidu') { %> |
|
var BAIDU_API_ID = "<%- config.baidu.apiId %>"; |
|
<%} else if(theme.search.service === 'algolia') { %> |
|
var ALGOLIA_API_KEY = "<%- config.algolia.apiKey %>"; |
|
var ALGOLIA_APP_ID = "<%- config.algolia.applicationID %>"; |
|
var ALGOLIA_INDEX_NAME = "<%- config.algolia.indexName %>"; |
|
<%} else if(theme.search.service === 'azure') { %> |
|
var AZURE_QUERY_KEY = "<%- config.azure.queryKey %>"; |
|
var AZURE_INDEX_NAME = "<%- config.azure.indexName %>"; |
|
var AZURE_SERVICE_NAME = "<%- config.azure.serviceName %>"; |
|
<%} else if(theme.search.service === 'google') { %> |
|
var GOOGLE_CUSTOM_SEARCH_API_KEY = "<%- config.google.apiKey %>"; |
|
var GOOGLE_CUSTOM_SEARCH_ENGINE_ID = "<%- config.google.engineId %>"; |
|
<%}%> |
|
var SEARCH_SERVICE = "<%- theme.search.service%>" || "hexo"; |
|
var ROOT = "<%- config.root %>" || "/"; |
|
if (!ROOT.endsWith('/')) ROOT += '/'; |
|
</script> |
|
<% } %> |
|
<% if (theme.plugins.instant_page) { %> |
|
<script async src="<%- theme.plugins.instant_page %>" type="module" defer integrity="sha384-OeDn4XE77tdHo8pGtE1apMPmAipjoxUQ++eeJa6EtJCfHlvijigWiJpD7VDPWXV1"></script> |
|
<% } %> |
|
<% if (theme.footer.aplayer.enable) { %> |
|
<script async src="https://cdn.jsdelivr.net/npm/aplayer@1.10/dist/APlayer.min.js"></script> |
|
<script async src="https://cdn.jsdelivr.net/npm/meting@2.0/dist/Meting.min.js"></script> |
|
<% } %> |
|
<% if (theme.plugins.scrollreveal) { %> |
|
<script src="<%- theme.plugins.scrollreveal %>"></script> |
|
<script type="text/javascript"> |
|
$(function() { |
|
const $reveal = $('.reveal'); |
|
if ($reveal.length === 0) return; |
|
const sr = ScrollReveal({ distance: 0 }); |
|
sr.reveal('.reveal'); |
|
}); |
|
</script> |
|
<% } %> |
|
<% if (theme.plugins.nodewaves && theme.plugins.nodewaves.js) { %> |
|
<%- js({src: theme.plugins.nodewaves.js, async: true }) %> |
|
<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> |
|
<% } %> |
|
<% if (theme.plugins.busuanzi) { %> |
|
<script async src="<%- theme.plugins.busuanzi %>"></script> |
|
<% } %> |
|
|
|
<% if (theme.backstretch && theme.backstretch.enable && (theme.backstretch.images || page.images)) { %> |
|
<% var imgs = theme.backstretch.images || page.images; %> |
|
<% var posi = null; |
|
if (theme.backstretch.position == 'cover') { |
|
posi = '.cover'; |
|
} |
|
%> |
|
<% if (imgs != undefined && theme.backstretch.position != undefined){ %> |
|
<%- js(theme.backstretch.js) %> |
|
<script type="text/javascript"> |
|
$(function(){ |
|
if ('<%- posi %>') { |
|
$('<%- posi %>').backstretch( |
|
<%- '["' + imgs.join('", "') + '"]' %>, |
|
{ |
|
duration: "<%- theme.backstretch.duration %>", |
|
fade: "<%- theme.backstretch.fade %>" |
|
}); |
|
} else { |
|
$.backstretch( |
|
<%- '["' + imgs.join('", "') + '"]' %>, |
|
{ |
|
duration: "<%- theme.backstretch.duration %>", |
|
fade: "<%- theme.backstretch.fade %>" |
|
}); |
|
} |
|
}); |
|
</script> |
|
<% } %> |
|
<% } %> |
|
|
|
|
|
<% |
|
var enableDisqus = false; |
|
var enableLivere = false; |
|
var enableGitalk = false; |
|
var enableValine = false; |
|
if (page && page.comments == true) { |
|
if (config.disqus_shortname) { |
|
enableDisqus = true; |
|
} |
|
if (config.livere_uid) { |
|
enableLivere = true; |
|
} |
|
if (config.gitalk) { |
|
enableGitalk = true; |
|
} |
|
if (theme.valine.enable && config.leancloud) { |
|
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 (enableGitalk) { %> |
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.css"> |
|
<script src="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js"></script> |
|
<script type="text/javascript"> |
|
var gitalk = new Gitalk({ |
|
clientID: "<%- config.gitalk.clientID %>", |
|
clientSecret: "<%- config.gitalk.clientSecret %>", |
|
repo: "<%- config.gitalk.repo %>", |
|
owner: "<%- config.gitalk.owner %>", |
|
admin: "<%- config.gitalk.admin %>", |
|
<% if(page.gitalk && page.gitalk.id) { %> |
|
id: "<%= page.gitalk.id %>", |
|
<% } else { %> |
|
id: location.pathname, // Ensure uniqueness and length less than 50 |
|
<% } %> |
|
distractionFreeMode: false // Facebook-like distraction free mode |
|
}); |
|
gitalk.render('gitalk-container'); |
|
</script> |
|
<% } %> |
|
|
|
<% if (enableValine){ %> |
|
<% if (config.use_cdn && theme.info && theme.info.cdn && theme.info.cdn.js && theme.info.cdn.js.valine) { %> |
|
<%- js(theme.info.cdn.js.valine) %> |
|
<% } else { %> |
|
<%- js(['js/valine.js']) %> |
|
<% } %> |
|
<script> |
|
var GUEST_INFO = ['nick','mail','link']; |
|
var guest_info = '<%= theme.valine.guest_info %>'.split(',').filter(function(item){ |
|
return GUEST_INFO.indexOf(item) > -1 |
|
}); |
|
var notify = '<%= theme.valine.notify %>' == true; |
|
var verify = '<%= theme.valine.verify %>' == true; |
|
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 %>", |
|
<% } else if (config.leancloud.valine_path) { %> |
|
path: "<%= config.leancloud.valine_path %>", |
|
<% } %> |
|
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 %>', |
|
visitor: '<%- theme.valine.visitor %>', |
|
highlight:'<%= theme.valine.highlight %>' |
|
}) |
|
</script> |
|
<% } %> |
|
|
|
<% if (config.use_cdn && theme.info && theme.info.cdn && theme.info.cdn.js && theme.info.cdn.js.app) { %> |
|
<%- js(theme.info.cdn.js.app) %> |
|
<% } else { %> |
|
<%- js(['js/app.js']) %> |
|
<% } %> |
|
<% if (config.use_cdn && 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']) %> |
|
<% } %> |
|
<% if (theme.plugins.comment_typing) { %> |
|
<%- js(theme.plugins.comment_typing) %> |
|
<%}%> |
|
|
|
<!-- 复制 --> |
|
<% if (theme.plugins.clipboard) { %> |
|
<%- partial('_third-party/clipboard') %> |
|
<% } %> |
|
|
|
|
|
<!-- fancybox --> |
|
<% if (theme.plugins.fancybox) { %> |
|
<%- partial('_third-party/fancybox') %> |
|
<% } %> |
|
|
|
|
|
<% if (config.import && config.import.script){ %> |
|
<% (config.import.script||[]).forEach(function(item){ %> |
|
<%- item %><% }) %> |
|
<% } %>
|
|
|