Django fixes

This commit is contained in:
Paul committed 2018-02-05 17:14:03 +01:00
1 parent 30b8c224c1
commit 80dd9e0d07
8 files changed
+82 -119

No files matched your search

+4 -47
View File
@@ -1,17 +1,10 @@
$(function () {
var changed = false;
// Hints
function processHints() {
$('.hint').replaceWith(function () {
return '<div><a href="#" class="hintlink" onclick="$(this).next().slideToggle(); return false;">Bekijk hint</a>' + $(this).hide()[0].outerHTML + '</div>';
});
$('#difficulty').trigger('change');
}
$('.hint').replaceWith(function () {
return '<div><a href="#" class="hintlink" onclick="$(this).next().slideToggle(); return false;">Bekijk hint</a>' + $(this).hide()[0].outerHTML + '</div>';
});
$('#difficulty').trigger('change');
$('#difficulty').change(function (e) {
var option = $(this).find(':selected').val();
@@ -34,40 +27,4 @@ $(function () {
}).prop('selected', true);
$('#difficulty').trigger('change');
function loadPage(page) {
$('#quiz').load('/' + page + '.html?cachebuster=' + Math.random(), processHints);
}
function getPage(link) {
if (link.lastIndexOf('?') === -1) {
return '';
}
return link.substring(link.lastIndexOf('?') + 1);
}
// Dynamically load pages
$('#menu a').click(function (e, element) {
var page = getPage(e.target.href);
window.history.pushState({ page: page }, 'Security', e.target.href);
loadPage(page);
e.preventDefault();
});
window.onpopstate = function (event) {
if (event.state) {
loadPage(event.state.page);
} else {
window.location.href = '/';
}
}
// Load page
var page = getPage(window.location.href);
if (page !== '') {
loadPage(page);
} else {
loadPage('sql');
}
});