From 8bc4466dbb30817c9389322ce2d721993033166b Mon Sep 17 00:00:00 2001 From: Daniel Sinn Date: Tue, 22 Dec 2015 23:31:26 -0500 Subject: [PATCH 1/2] Add ugly quick-nav --- index.html | 4 ++++ ktane.css | 15 +++++++++++++++ ktane.js | 5 +++++ 3 files changed, 24 insertions(+) diff --git a/index.html b/index.html index c0fd16c..10ce8cc 100755 --- a/index.html +++ b/index.html @@ -7,6 +7,10 @@ + +

Keep Talking and Nobody Explodes

diff --git a/ktane.css b/ktane.css index 4b809be..7398502 100755 --- a/ktane.css +++ b/ktane.css @@ -80,6 +80,21 @@ h2 { margin-top: 1em; } +nav { + background-color: white; + border-left: 1px solid black; + border-top: 1px solid black; + position: fixed; + bottom: 0; + right: 0; +} +#navList { + line-height: 150%; + list-style-type: none; + margin: 0; + padding-left: 0.2em; +} + #sectionWires button { border-color: black; cursor: pointer; diff --git a/ktane.js b/ktane.js index 9739d91..e37c5bd 100755 --- a/ktane.js +++ b/ktane.js @@ -26,6 +26,11 @@ $('.jsResetSection').on('click', function () { ktane.resetInputs($(this).closest('section')).filter('[type="text"]').first().focus(); }); +$('section').each(function () { + var $navList = $('#navList'); + $navList.append('
  • ' + $(this).find('h2').first().text() + '
  • '); +}); + (function () { /** * Wires From 467bd4b534353c00ee28d6a217dfb8672bc0d5b7 Mon Sep 17 00:00:00 2001 From: Daniel Sinn Date: Tue, 22 Dec 2015 23:47:07 -0500 Subject: [PATCH 2/2] Add auto-expand for nav, and missing section IDs --- index.html | 4 ++-- ktane.js | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 10ce8cc..e31c96e 100755 --- a/index.html +++ b/index.html @@ -325,7 +325,7 @@
      -
      +

      Venn Diagram

      • @@ -336,7 +336,7 @@
      -
      +

      Passwords

        diff --git a/ktane.js b/ktane.js index e37c5bd..fa6dd8b 100755 --- a/ktane.js +++ b/ktane.js @@ -7,6 +7,7 @@ $('h2').on('dblclick', function () { $(this).closest('section').toggleClass('collapsed'); }).attr('title', 'Double-click to expand/collapse'); +/** Reset inputs */ ktane.resetInputs = function ($container) { $container.find('textarea').val(''); @@ -26,9 +27,15 @@ $('.jsResetSection').on('click', function () { ktane.resetInputs($(this).closest('section')).filter('[type="text"]').first().focus(); }); +/** Navigation */ $('section').each(function () { - var $navList = $('#navList'); - $navList.append('
      • ' + $(this).find('h2').first().text() + '
      • '); + var $section = $(this), + id = $section.attr('id'), + $a = $('' + $(this).find('h2').first().text() + '').on('click', function () { + $section.removeClass('collapsed'); + }); + + id && $('#navList').append($('
      • ').append($a)); }); (function () {