ui: add experimental speculation rules

This commit is contained in:
undefined committed 2024-08-08 11:28:27 +08:00
1 parent a859d8a5f8
commit 4be997d919
3 files changed
+40 -9

No files matched your search

+12 -1
View File
@@ -1,7 +1,7 @@
import { formatSeconds } from '@hydrooj/utils/lib/common';
import NProgress from 'nprogress';
import { NamedPage } from 'vj/misc/Page';
import { tpl } from 'vj/utils';
import { addSpeculationRules, tpl } from 'vj/utils';
const contestTimer = $(tpl`<pre class="contest-timer" style="display:none"></pre>`);
contestTimer.appendTo(document.body);
@@ -21,4 +21,15 @@ export default new NamedPage(['contest_detail', 'contest_problemlist', 'contest_
NProgress.start();
updateProgress();
setInterval(updateProgress, 1000);
addSpeculationRules({
prerender: [{
'where': {
'or': [
{ 'href_matches': '/p/*' },
{ 'href_matches': '/d/*/p/*' },
],
},
}],
});
});