hexo-theme-stellar/layout/_partial/scripts/index.ejs

52 lines
1.8 KiB
Plaintext

<script type="text/javascript">
stellar = {};
stellar.github = 'https://github.com/xaoxuu/hexo-theme-stellar/tree/<%- theme.stellar.version %>';
stellar.config = {
date_suffix: {
just: '<%- __('meta.date_suffix.just') %>',
min: '<%- __('meta.date_suffix.min') %>',
hour: '<%- __('meta.date_suffix.hour') %>',
day: '<%- __('meta.date_suffix.day') %>',
month: '<%- __('meta.date_suffix.month') %>',
},
};
// required plugins (only load if needs)
stellar.plugins = {
jQuery: '<%- url_for(theme.plugins.jquery || "https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js") %>',
sitesjs: '<%- url_for(theme.plugins.sitesjs) %>',
friendsjs: '<%- url_for(theme.plugins.friendsjs) %>',
};
// optional plugins
if ('<%- theme.plugins.lazyload.enable %>' == 'true') {
stellar.plugins.lazyload = Object.assign(<%- JSON.stringify(theme.plugins.lazyload) %>);
}
if ('<%- theme.plugins.swiper.enable %>' == 'true') {
stellar.plugins.swiper = Object.assign(<%- JSON.stringify(theme.plugins.swiper) %>);
}
if ('<%- theme.plugins.scrollreveal.enable %>' == 'true') {
stellar.plugins.scrollreveal = Object.assign(<%- JSON.stringify(theme.plugins.scrollreveal) %>);
}
if ('<%- theme.plugins.preload.enable %>' == 'true') {
stellar.plugins.preload = Object.assign(<%- JSON.stringify(theme.plugins.preload) %>);
}
</script>
<!-- required -->
<% if (theme.stellar.cdn_js) { %>
<%- js({src: theme.stellar.cdn_js, async: true}) %>
<% } else { %>
<%- js({src: '/js/main.js', async: true}) %>
<% } %>
<!-- optional -->
<%- partial('../plugins/comments/script') %>
<!-- inject -->
<% if (config.inject && config.inject.script && config.inject.script.length > 0) { %>
<% config.inject.script.forEach(function(js) { %>
<%- js %>
<% }) %>
<% } %>