diff --git a/css/stylesheet.css b/css/stylesheet.css index e80ae8502dfc707e18b53659543900caf303c4be..7d5609ca6822e3293beb3d4ec04a67c166dda083 100644 --- a/css/stylesheet.css +++ b/css/stylesheet.css @@ -42,6 +42,10 @@ button.active { background: rgb(44, 44, 44); } +button.category { + background: rgba(0, 0, 0, .10); +} + button.indent { padding-left: 36px; } @@ -90,7 +94,11 @@ nav h3 { visibility: visible; } -#list > button { +.sidemenu #header { + border-top: 2px solid rgb(44, 44, 44); +} + +.sidemenu button { display: block; width: 100%; height: 30px; @@ -163,6 +171,10 @@ section { visibility: visible; } +#tab_desc > .wrapper a { + text-decoration: underline; +} + .tab_bar { bottom: 0; left: 0; diff --git a/index.html b/index.html index c5f88ec9cf74ac9d7aff1b405410b6c82085299d..91fd1313dbd635935067be503db8a2254fba2f52 100644 --- a/index.html +++ b/index.html @@ -30,6 +30,11 @@
+ Fork me on GitHub
@@ -37,7 +42,7 @@
-
+

@@ -61,7 +66,7 @@
- +
diff --git a/js/module/array2d.js b/js/module/array2d.js index 0fab70027c9c1437ea2be43b16535452b09fcadf..a465683c17741507004226cb0008c3cc4b2825fc 100644 --- a/js/module/array2d.js +++ b/js/module/array2d.js @@ -256,7 +256,6 @@ Array2DTracer.prototype.mousewheel = function (e) { }; var initTable = function () { - $module_container.empty(); $table = $('
'); $module_container.append($table); }; diff --git a/js/module/graph.js b/js/module/graph.js index da32826ae4616b71441ea3ce05b7fd7978d56b57..e156a8122a0822b9ebd04489c81d9d2d3116dea2 100644 --- a/js/module/graph.js +++ b/js/module/graph.js @@ -183,7 +183,6 @@ GraphTracer.prototype.prevStep = function () { }; var initGraph = function () { - $module_container.empty(); if (sigmaCanvas == null) { sigmaCanvas = $.extend(true, {}, sigma.canvas); } else { diff --git a/js/module/tracer.js b/js/module/tracer.js index 477fd5d8226eb7a1168e5a7008bf88f323b985a8..ade801dd7c699242fd26f9622e8dc610d85821f3 100644 --- a/js/module/tracer.js +++ b/js/module/tracer.js @@ -10,7 +10,9 @@ var Tracer = function (module) { this.traceIndex = -1; this.stepCnt = 0; - return lastModule != module; + var moduleChanged = lastModule != module; + if (moduleChanged) $module_container.empty(); + return moduleChanged; }; Tracer.prototype.resize = function () { diff --git a/js/script.js b/js/script.js index 9d011056813bd46186e5de501eaff914af96ae58..334b17bbef5e9a8c8e3b07ab37d9ccb5b066f0b5 100644 --- a/js/script.js +++ b/js/script.js @@ -1,5 +1,14 @@ $.ajaxSetup({cache: false, dataType: "text"}); +$(document).on('click', 'a', function (e) { + e.preventDefault(); + + var win = window.open($(this).attr('href'), '_blank'); + if (!win) { + alert('Please allow popups for this site'); + } +}); + var $module_container = $('.module_container'); var _tracer = new Tracer(); var initEditor = function (id) { @@ -41,15 +50,11 @@ var loadFile = function (category, algorithm, file, explanation) { var loadAlgorithm = function (category, algorithm) { $('#list > button').removeClass('active'); $('[data-category="' + category + '"][data-algorithm="' + algorithm + '"]').addClass('active'); - $('#btn_description').click(); + $('#btn_desc').click(); $('#category').text(list[category].name); $('#algorithm, #desc_title').text(list[category].list[algorithm]); - $('#desc_def').html(''); - $('#desc_app').empty(); - $('#desc_time').html(''); - $('#desc_space').html(''); - $('#desc_ref').empty(); + $('#tab_desc > .wrapper').empty(); $('.files_bar').empty(); $('#explanation').html(''); dataEditor.setValue(''); @@ -57,20 +62,34 @@ var loadAlgorithm = function (category, algorithm) { var dir = './algorithm/' + category + '/' + algorithm + '/'; $.getJSON(dir + 'desc.json', function (data) { - $('#desc_def').html(data.def); - $('#desc_app').empty(); - data.apps.forEach(function (app) { - $('#desc_app').append($('
  • ').html(app)); - }); - $('#desc_time').html(data.cpx.time); - $('#desc_space').html(data.cpx.space); - $('#desc_ref').empty(); - data.refs.forEach(function (ref) { - $('#desc_ref').append($('
  • ').html('' + ref + '')); - }); + var files = data.files; + delete data.files; + + var $container = $('#tab_desc > .wrapper'); + $container.empty(); + for (var key in data) { + if (key) $container.append($('

    ').html(key)); + var value = data[key]; + if (typeof value === "string") { + $container.append($('

    ').html(value)); + } else if (Array.isArray(value)) { + var $ul = $('

      '); + $container.append($ul); + value.forEach(function (li) { + $ul.append($('
    • ').html(li)); + }); + } else if (typeof value === "object") { + var $ul = $('
        '); + $container.append($ul); + for (var prop in value) { + $ul.append($('
      • ').append($('').html(prop)).append(' ' + value[prop])); + } + } + } + $('.files_bar').empty(); var init = false; - for (var file in data.files) { + for (var file in files) { (function (file, explanation) { var $file = $('