Update pjax version

This commit is contained in:
Mimi 2020-06-21 23:58:46 +08:00
parent b9a822c4b7
commit ee3be0a81a
4 changed files with 6 additions and 32 deletions

View File

@ -504,7 +504,7 @@ math:
copy_tex: false
# Easily enable fast Ajax navigation on your website.
# Dependencies: https://github.com/next-theme/pjax
# For more information: https://github.com/next-theme/pjax
pjax: false
# FancyBox is a tool that offers a nice and elegant way to add zooming functionality for images.
@ -902,7 +902,7 @@ vendors:
copy_tex_js:
copy_tex_css:
# Internal version: 0.2.8
# Recommended version: 0.4.0
# pjax: //cdn.jsdelivr.net/gh/next-theme/pjax@0/pjax.min.js
pjax:
@ -978,7 +978,7 @@ vendors:
pace:
pace_css:
# Internal version: 1.0.0
# JavaScript 3D library
# three: //cdn.jsdelivr.net/npm/three@0/build/three.min.js
# three_waves: //cdn.jsdelivr.net/gh/next-theme/theme-next-three@1/three-waves.min.js
# canvas_lines: //cdn.jsdelivr.net/gh/next-theme/theme-next-three@1/canvas_lines.min.js

View File

@ -3,7 +3,7 @@
{{ canonical() }}
{# Exports some front-matter variables to Front-End #}
<script id="page-configurations">
<script{{ pjax }} id="page-configurations">
// https://hexo.io/docs/variables.html
CONFIG.page = {
sidebar: {{ page.sidebar | json }},

View File

@ -17,33 +17,7 @@ var pjax = new Pjax({
});
document.addEventListener('pjax:success', () => {
document.querySelectorAll('script[data-pjax], script#page-configurations, #pjax script').forEach(element => {
var code = element.text || element.textContent || element.innerHTML || '';
var parent = element.parentNode;
parent.removeChild(element);
var script = document.createElement('script');
if (element.id) {
script.id = element.id;
}
if (element.className) {
script.className = element.className;
}
if (element.type) {
script.type = element.type;
}
if (element.src) {
script.src = element.src;
// Force synchronous loading of peripheral JS.
script.async = false;
}
if (element.dataset.pjax !== undefined) {
script.dataset.pjax = '';
}
if (code !== '') {
script.appendChild(document.createTextNode(code));
}
parent.appendChild(script);
});
pjax.executeScripts(document.querySelectorAll('script[data-pjax], #pjax script'));
NexT.boot.refresh();
// Define Motion Sequence & Bootstrap Motion.
if (CONFIG.motion.enable) {

View File

@ -15,7 +15,7 @@ hexo.extend.helper.register('js_vendors', function() {
}
}
if (theme.pjax) {
vendors.pjax = 'pjax/pjax.min.js';
vendors.pjax = '//cdn.jsdelivr.net/gh/next-theme/pjax@0/pjax.min.js';
}
if (theme.fancybox) {
vendors.jquery = '//cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js';