Skip to content

Commit 40e5141

Browse files
Patch pangu.js
1 parent 509815e commit 40e5141

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

source/js/next-boot.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,18 @@ NexT.boot.refresh = function() {
4747
background: 'var(--content-bg-color)'
4848
});
4949
CONFIG.lazyload && window.lozad('.post-body img').observe();
50-
CONFIG.pangu && window.pangu.spacingElementByTagName('main');
50+
if (CONFIG.pangu) {
51+
// Polyfill for requestIdleCallback if not supported
52+
if (!window.requestIdleCallback) {
53+
window.requestIdleCallback = function(cb) {
54+
cb({
55+
didTimeout : false,
56+
timeRemaining: () => 100
57+
});
58+
};
59+
}
60+
[...document.getElementsByTagName('main')].forEach(e => window.pangu.spacingNode(e));
61+
}
5162

5263
CONFIG.exturl && NexT.utils.registerExtURL();
5364
NexT.utils.wrapTableWithBox();

0 commit comments

Comments
 (0)