forked from ppoffice/hexo-theme-icarus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): Add preliminary support for PJAX
Implements ppoffice#1277 Related ppoffice#1269 ppoffice#992 ppoffice#722 ppoffice#649 ppoffice#507
- Loading branch information
Showing
4 changed files
with
44 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()); |