Added app.preload module to be able to add preload methods for other UI modules
This commit is contained in:
parent
4e3501ce37
commit
f273506d9d
|
@ -396,6 +396,13 @@ function scriptPageHandler(modname, cfg) {
|
||||||
app.hashHandlers.push(cfg);
|
app.hashHandlers.push(cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
app.preload = {
|
||||||
|
quiz: function() {
|
||||||
|
app.script('pages.quiz');
|
||||||
|
app.template.load('quiz.index');
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
window.onload = function(e) {
|
window.onload = function(e) {
|
||||||
dayjs.extend(window.dayjs_plugin_relativeTime);
|
dayjs.extend(window.dayjs_plugin_relativeTime);
|
||||||
dayjs.extend(window.dayjs_plugin_updateLocale);
|
dayjs.extend(window.dayjs_plugin_updateLocale);
|
||||||
|
|
|
@ -10,7 +10,7 @@ app.pages.home = {
|
||||||
await app.template.loadMany(['home.quiz_item']);
|
await app.template.loadMany(['home.quiz_item']);
|
||||||
app.pages.home.data.quizs = json;
|
app.pages.home.data.quizs = json;
|
||||||
app.pages.home.paint('quizs', json);
|
app.pages.home.paint('quizs', json);
|
||||||
app.template.load('quiz.index');
|
app.preload.quiz();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -231,7 +231,7 @@ app.pages.meet = {
|
||||||
if (typeof current.quiz_id === 'string') {
|
if (typeof current.quiz_id === 'string') {
|
||||||
document.getElementById('meet-action-crush').style.display = 'none';
|
document.getElementById('meet-action-crush').style.display = 'none';
|
||||||
document.getElementById('meet-action-quiz').style.removeProperty('display');
|
document.getElementById('meet-action-quiz').style.removeProperty('display');
|
||||||
app.template.load('quiz.index');
|
app.preload.quiz();
|
||||||
} else {
|
} else {
|
||||||
document.getElementById('meet-action-crush').style.removeProperty('display');
|
document.getElementById('meet-action-crush').style.removeProperty('display');
|
||||||
document.getElementById('meet-action-quiz').style.display = 'none';
|
document.getElementById('meet-action-quiz').style.display = 'none';
|
||||||
|
|
Loading…
Reference in New Issue