Expose current question index for global listeners and update browser URL to reflect the current question position
This commit is contained in:
@@ -93,6 +93,14 @@
|
||||
} catch (err) {
|
||||
console.warn('Could not update global question header from fragment', err);
|
||||
}
|
||||
// expose current question index for global listeners
|
||||
window.currentQuestionPos = {{ pos }};
|
||||
// Update the browser URL to reflect the current question (so Prev/Next/Skip update URL)
|
||||
try {
|
||||
const pageUrlTemplate = `{% if cid %}{% url 'physics:exam_take' pk=exam.pk sk=0 cid=cid passcode=passcode %}{% else %}{% url 'physics:exam_take_user' pk=exam.pk sk=0 %}{% endif %}`;
|
||||
const pageUrl = pageUrlTemplate.replace('/0/', '/' + window.currentQuestionPos + '/');
|
||||
history.replaceState(null, '', pageUrl);
|
||||
} catch (e) { /* ignore */ }
|
||||
{% if not exam.publish_results and not cid_user_exam.completed %}
|
||||
let time_limit = '{{ exam.time_limit }}';
|
||||
if (time_limit != 'None') {
|
||||
|
||||
Reference in New Issue
Block a user