Skip to content

Commit

Permalink
Update pjax version
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenjoezhang committed Jun 21, 2020
1 parent b9a822c commit ee3be0a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 32 deletions.
6 changes: 3 additions & 3 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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:

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion layout/_partials/head/head-unique.njk
Original file line number Diff line number Diff line change
Expand Up @@ -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 }},
Expand Down
28 changes: 1 addition & 27 deletions layout/_scripts/pjax.njk
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/helpers/next-vendors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit ee3be0a

Please sign in to comment.