Improving fix for #157

selenium-screenshot-testing
Kevin Chung 2016-09-27 22:10:35 -04:00
parent 60bb118e16
commit 9cf8dbf8ad
1 changed files with 6 additions and 5 deletions

View File

@ -17,7 +17,7 @@ function loadchalbyname(chalname) {
} }
function updateChalWindow(obj) { function updateChalWindow(obj) {
window.location.replace(window.location.href + '#' + obj.name); window.location.replace(window.location.href.split('#')[0] + '#' + obj.name);
var chal = $('#chal-window'); var chal = $('#chal-window');
chal.find('.chal-name').text(obj.name); chal.find('.chal-name').text(obj.name);
chal.find('.chal-desc').html(marked(obj.description, {'gfm':true, 'breaks':true})); chal.find('.chal-desc').html(marked(obj.description, {'gfm':true, 'breaks':true}));
@ -127,10 +127,6 @@ function marksolves() {
$('button[value="' + id + '"]').removeClass('theme-background'); $('button[value="' + id + '"]').removeClass('theme-background');
$('button[value="' + id + '"]').addClass('solved-challenge'); $('button[value="' + id + '"]').addClass('solved-challenge');
}; };
if (window.location.hash.length > 0){
loadchalbyname(window.location.hash.substring(1))
$("#chal-window").modal("show");
}
}); });
} }
@ -210,6 +206,11 @@ function loadchals() {
updatesolves(); updatesolves();
marksolves(); marksolves();
if (window.location.hash.length > 0) {
loadchalbyname(window.location.hash.substring(1));
$("#chal-window").modal("show");
}
$('.challenge-button').click(function (e) { $('.challenge-button').click(function (e) {
loadchal(this.value); loadchal(this.value);
}); });