Skip to content

Commit 828a9f0

Browse files
committed
Merge pull request algorithm-visualizer#102 from TornjV/fix/link
Link cleanup
2 parents 9358a24 + 488684a commit 828a9f0

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

js/script.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,8 @@ var executeDataAndCode = function () {
252252
showDescription(data);
253253
showFiles(category, algorithm, files);
254254
});
255+
var hash = isScratchPaper(category, algorithm) ? algorithm : category + '/' + algorithm;
256+
setHashValue('algorithm', hash);
255257
};
256258
var list = {};
257259
var anyOpened = false;
@@ -282,7 +284,6 @@ var executeDataAndCode = function () {
282284
.attr('data-algorithm', algorithm)
283285
.attr('data-category', category)
284286
.click(function () {
285-
setHashValue('algorithm', category + '/' + algorithm + '/desc');
286287
loadAlgorithm(category, algorithm);
287288
});
288289
$('#list').append($algorithm);
@@ -298,7 +299,6 @@ var executeDataAndCode = function () {
298299
if(anyRequested) {
299300
if(!list[requestedCategory] || !list[requestedCategory].list[requestedAlgorithm]) {
300301
showErrorToast('Oops! This link appears to be broken.');
301-
302302
$('#scratch-paper').click();
303303
} else {
304304
$('[data-category="' + requestedCategory + '"]').toggleClass('collapse');
@@ -396,7 +396,7 @@ var executeDataAndCode = function () {
396396
$('.tab_bar > button').removeClass('active');
397397
$(this).addClass('active');
398398
var algorithmHash = getAlgorithmHash();
399-
setHashValue('algorithm', algorithmHash['category'] + '/' + algorithmHash['algorithm'] + '/desc');
399+
setHashValue('algorithm', algorithmHash['category'] + '/' + algorithmHash['algorithm']);
400400
});
401401
$('#btn_trace').click(function () {
402402
$('.tab_container > .tab').removeClass('active');
@@ -610,7 +610,6 @@ var executeDataAndCode = function () {
610610
code: data.files['code.js'].content,
611611
'CREDIT.md': 'Shared by an anonymous user from http://parkjs814.github.io/AlgorithmVisualizer'
612612
};
613-
setHashValue('algorithm', 'scratch_paper');
614613
loadAlgorithm(category, algorithm);
615614
});
616615
};

0 commit comments

Comments
 (0)