From 9154046e4307e0ec8e0e3f505ce6cfaa60c67dab Mon Sep 17 00:00:00 2001 From: Paul Wagener Date: Thu, 1 Feb 2018 10:38:07 +0100 Subject: [PATCH] Fix hints --- index.html | 2 +- static/js/quiz.js | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index f97c33e..e2e6df1 100644 --- a/index.html +++ b/index.html @@ -8,7 +8,7 @@ - + diff --git a/static/js/quiz.js b/static/js/quiz.js index 0f1e69b..0a72ce9 100644 --- a/static/js/quiz.js +++ b/static/js/quiz.js @@ -3,18 +3,22 @@ $(function () { var changed = false; // Hints - $('.hint').replaceWith(function () { - return '
Bekijk hint' + $(this).hide()[0].outerHTML + '
'; - }); + + + function processHints() { + $('.hint').replaceWith(function () { + return '
Bekijk hint' + $(this).hide()[0].outerHTML + '
'; + }); + $('#difficulty').trigger('change'); + } + $('#difficulty').change(function (e) { var option = $(this).find(':selected').val(); - $('.hintlink').toggle(option == 'normal'); $('.hint').toggle(option == 'easy'); - window.localStorage.setItem('difficulty', option); }); @@ -31,7 +35,7 @@ $(function () { $('#difficulty').trigger('change'); function loadPage(page) { - $('#quiz').load('/' + page + '.html?cachebuster=' + Math.random()); + $('#quiz').load('/' + page + '.html?cachebuster=' + Math.random(), processHints); } function getPage(link) {