diff --git a/layout/common/scripts.jsx b/layout/common/scripts.jsx
index 42fe538e3..0bf1a45ac 100644
--- a/layout/common/scripts.jsx
+++ b/layout/common/scripts.jsx
@@ -1,6 +1,7 @@
const { Component, Fragment } = require('inferno');
const { toMomentLocale } = require('hexo/dist/plugins/helper/date');
const Plugins = require('./plugins');
+const pjaxMinJsPath = require.resolve('pjax/pjax.min.js');
module.exports = class extends Component {
render() {
@@ -32,12 +33,15 @@ module.exports = class extends Component {
return
+ {/* */}
+
{clipboard && }
-
+
-
+
+
;
}
};
diff --git a/layout/plugin/back_to_top.jsx b/layout/plugin/back_to_top.jsx
index c3b6e8d71..4581815cc 100644
--- a/layout/plugin/back_to_top.jsx
+++ b/layout/plugin/back_to_top.jsx
@@ -9,7 +9,7 @@ class BackToTop extends Component {
-
+
;
}
diff --git a/package.json b/package.json
index c03923ff0..b999c1600 100644
--- a/package.json
+++ b/package.json
@@ -39,6 +39,7 @@
"inferno": "^8.2.3",
"inferno-create-element": "^8.2.3",
"moment": "^2.30.1",
+ "pjax": "^0.2.8",
"semver": "^7.5.4"
}
}
diff --git a/source/js/pjax.js b/source/js/pjax.js
new file mode 100644
index 000000000..2fec27d50
--- /dev/null
+++ b/source/js/pjax.js
@@ -0,0 +1,36 @@
+// eslint-disable-next-line no-unused-vars
+let pjax;
+
+function initPjax() {
+ try {
+ // eslint-disable-next-line no-undef
+ pjax = new Pjax({
+ selectors: [
+ 'head title',
+ '.columns',
+ '.navbar-start',
+ '.navbar-end',
+ '.searchbox',
+ '#back-to-top',
+ '[data-pjax]',
+ '.pjax-reload'
+ ]
+ });
+ } catch (e) {
+ console.warn('PJAX error: ' + e);
+ }
+}
+
+// // Listen for start of Pjax
+// document.addEventListener('pjax:send', function() {
+// return;
+// // TODO pace start loading animation
+// })
+
+// // Listen for completion of Pjax
+// document.addEventListener('pjax:complete', function() {
+// return;
+// // TODO pace stop loading animation
+// })
+
+window.addEventListener('DOMContentLoaded', () => initPjax());
\ No newline at end of file