diff --git a/web/src/app/js/app.js b/web/src/app/js/app.js index e844bbc..5a585bc 100644 --- a/web/src/app/js/app.js +++ b/web/src/app/js/app.js @@ -396,6 +396,13 @@ function scriptPageHandler(modname, cfg) { app.hashHandlers.push(cfg); } +app.preload = { + quiz: function() { + app.script('pages.quiz'); + app.template.load('quiz.index'); + }, +} + window.onload = function(e) { dayjs.extend(window.dayjs_plugin_relativeTime); dayjs.extend(window.dayjs_plugin_updateLocale); diff --git a/web/src/app/js/pages/home.js b/web/src/app/js/pages/home.js index 735cdd4..d9180ce 100644 --- a/web/src/app/js/pages/home.js +++ b/web/src/app/js/pages/home.js @@ -10,7 +10,7 @@ app.pages.home = { await app.template.loadMany(['home.quiz_item']); app.pages.home.data.quizs = json; app.pages.home.paint('quizs', json); - app.template.load('quiz.index'); + app.preload.quiz(); }); }); }, diff --git a/web/src/app/js/pages/meet.js b/web/src/app/js/pages/meet.js index 75e61eb..babd844 100644 --- a/web/src/app/js/pages/meet.js +++ b/web/src/app/js/pages/meet.js @@ -231,7 +231,7 @@ app.pages.meet = { if (typeof current.quiz_id === 'string') { document.getElementById('meet-action-crush').style.display = 'none'; document.getElementById('meet-action-quiz').style.removeProperty('display'); - app.template.load('quiz.index'); + app.preload.quiz(); } else { document.getElementById('meet-action-crush').style.removeProperty('display'); document.getElementById('meet-action-quiz').style.display = 'none';