diff --git a/index.html b/index.html index 094b1d9..c0fd16c 100755 --- a/index.html +++ b/index.html @@ -13,11 +13,11 @@

Wires

@@ -27,10 +27,10 @@

Button

Colour: - - - - + + + +
Text: @@ -43,13 +43,57 @@
If holding the button and the strip colour is
+
+

Simon Says

+ +
+ + +
    +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
+
+ +
+
+
 
 
+
+
+
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

Who's on First

@@ -264,15 +308,15 @@

Wire Sequence

    -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
    @@ -305,4 +349,4 @@ - \ No newline at end of file + diff --git a/ktane.css b/ktane.css index ebf9b72..4b809be 100755 --- a/ktane.css +++ b/ktane.css @@ -22,31 +22,39 @@ button { border-width: 1px; } -.buttonRed, .buttonYellow, .buttonBlue, .buttonWhite, .buttonBlack { - color: black; +.button { padding: 0.2em; } -.buttonRed { +.red { background-color: red; color: white; } -.buttonYellow { +.yellow { background-color: yellow; + color: black; } -.buttonBlue { +.blue { background-color: blue; color: white; } -.buttonWhite { +.green { + background-color: green; + color: white; +} +.white { background-color: white; border-color: black; + color: black; } -.buttonBlack { +.black { background-color: black; color: white; } +.button.white { + border: 1px solid black; +} -.active { +section .active { /* ugh, specificity */ opacity: 1; } .inactive { @@ -108,6 +116,115 @@ h2 { border-width: 1px; } +#simonInputs { + float: left; + margin-right: 5em; +} +.collapsed #simonBoard { + display: none; +} +#simonBoard { + display: inline-block; + padding-bottom: 40px; /* Compensate for height increase as a result of rotation */ + position: relative; + transform: rotate(45deg); +} +#simonBoard > div > div { + border: 2px solid black; + display: inline-block; + height: 64px; + width: 64px; +} +#simonBoard > .simonRow:first-child > div { + border-top-width: 4px; +} +#simonBoard > .simonRow:first-child + div > div { + border-bottom-width: 4px; +} +#simonBoard > .simonRow > div:first-child { + border-left-width: 4px; +} +#simonBoard > .simonRow > div:last-child { + border-right-width: 4px; +} + +.arrow { + background-color: magenta; + height: 10px; + width: 50px; + opacity: 0; + position: absolute; +} +.arrow::after { + content: ''; + border-top: 10px solid transparent; + border-left: 20px solid magenta; + border-bottom: 10px solid transparent; + height: 0; + width: 0; + margin-left: 50px; + position: absolute; + top: -5px; +} +#arrowRB { + top: 70px; + left: 10px; + transform: rotate(-90deg); +} +#arrowBR { + top: 60px; + left: 10px; + transform: rotate(90deg); +} +#arrowBY { + top: 30px; + left: 45px; +} +#arrowYB { + top: 30px; + left: 45px; + transform: rotate(180deg); +} +#arrowYG { + top: 60px; + left: 80px; + transform: rotate(90deg); +} +#arrowGY { + top: 70px; + left: 80px; + transform: rotate(-90deg); +} +#arrowGR { + top: 100px; + left: 45px; + transform: rotate(180deg); +} +#arrowRG { + top: 100px; + left: 45px; +} +#arrowRY { + top: 66px; + left: 44px; + transform: rotate(-45deg); +} +#arrowYR { + top: 66px; + left: 44px; + transform: rotate(135deg); +} +#arrowBG { + top: 64px; + left: 44px; + transform: rotate(45deg); +} +#arrowGB { + top: 64px; + left: 44px; + transform: rotate(-135deg); +} + #sectionDisplay { white-space: nowrap; } diff --git a/ktane.js b/ktane.js index 3817ccd..9739d91 100755 --- a/ktane.js +++ b/ktane.js @@ -42,8 +42,8 @@ $('.jsResetSection').on('click', function () { $('#wireOptions button').on('click', function () { var colour = this.getAttribute('data-colour'), letter = this.getAttribute('data-letter'), - $li = $('
  • '); + $li = $('
  • '); $wireList.append($li); count[colour]++; @@ -166,6 +166,46 @@ $('.jsResetSection').on('click', function () { }); })(); +(function () { + /** + * Simon + */ + var $checkbox = $('#simonVowel'), + $strikeButtons = $('#sectionSimon input[name="simonStrikes"]'), + $arrows = [], + mappings = [ // (hasVowel, strikes) -> list of visible arrows by ID + // No vowel + [ + ['RB', 'BY', 'YR'], + ['GY', 'YG'], + ['RY', 'BG', 'GB', 'YR'] + ], + // Vowel + [ + ['RB', 'BR', 'GY', 'YG'], + ['RY', 'BG', 'GB', 'YR'], + ['RG', 'BR', 'GY', 'YB'] + ] + ]; + + $('#simonBoard').find('.arrow').each(function (i, arrow) { + $arrows[arrow.id.replace(/^.*(?=..$)/, '')] = $(arrow); + }); + + $('#sectionSimon input').on('change', function () { + var hasVowel = +$checkbox.prop('checked'), + strikes = $strikeButtons.filter(':checked').val(); + + for (var id in $arrows) { + $arrows[id].removeClass('active'); + } + + $.each(mappings[hasVowel][strikes], function (i, id) { + $arrows[id].addClass('active'); + }); + }).first().trigger('change'); +})(); + (function () { /** * Memory @@ -350,8 +390,8 @@ $('.jsResetSection').on('click', function () { $('#sequenceOptions button').on('click', function () { var colour = this.getAttribute('data-colour'), letter = this.getAttribute('data-letter'), - $li = $('
  • '); + $li = $('
  • '); if (typeof occurrences[colour][count[colour]] !== 'undefined') { $li.append(occurrences[colour][count[colour]].indexOf(letter) === -1 ? 'Ignore' : 'Cut');