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

50 lines
1.7 KiB
Plaintext
Raw Normal View History

2021-02-21 17:27:48 +08:00
<script type="text/javascript">
stellar = {};
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") %>',
issuesjs: '<%- url_for(theme.plugins.issuesjs || "/js/issues.js") %>',
};
// 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>
2021-02-19 23:33:19 +08:00
<!-- required -->
<% if (theme.stellar.cdn_js) { %>
<%- js({src: theme.stellar.cdn_js, async: true}) %>
<% } else { %>
2021-02-21 17:27:48 +08:00
<%- js({src: '/js/main.js', async: true}) %>
2021-02-19 23:33:19 +08:00
<% } %>
2021-02-20 13:09:41 +08:00
2021-02-19 23:33:19 +08:00
<!-- optional -->
<%- partial('../plugins/comments/script') %>
<!-- inject -->
<% if (config.inject && config.inject.script && config.inject.script.length > 0) { %>
<% config.inject.script.forEach(function(js) { %>
<%- js %>
<% }) %>
<% } %>