Skip to content

Commit

Permalink
fixed shift pop bug in currentBank, added favicon
Browse files Browse the repository at this point in the history
  • Loading branch information
p44v9n authored and p44v9n committed Mar 16, 2017
1 parent 2194d12 commit 00a9aa5
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
4 changes: 4 additions & 0 deletions css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,8 @@ td {
white-space: nowrap;
overflow: hidden;
color:black;
}

del {
cursor:pointer;
}
Binary file added img/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 14 additions & 11 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
<!-- Stylesheets -->
<link rel="stylesheet" href="css/normalize.min.css">
<link rel="stylesheet" href="css/main.css">
<link rel="icon" type="image/png" href="img/favicon.png" />

</head>
<body>
<div class="menu">
Expand All @@ -17,15 +19,6 @@
</div>
</div>
<h1>Stack Trainer</h1>
<div class="menu">
<div id="buttonlist">
<button onclick="window.open('https://github.com/p44v9n/ko-stack-trainer', '_blank')">Contribute <svg class="external" width="14" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1408 928v320q0 119-84.5 203.5t-203.5 84.5h-832q-119 0-203.5-84.5t-84.5-203.5v-832q0-119 84.5-203.5t203.5-84.5h704q14 0 23 9t9 23v64q0 14-9 23t-23 9h-704q-66 0-113 47t-47 113v832q0 66 47 113t113 47h832q66 0 113-47t47-113v-320q0-14 9-23t23-9h64q14 0 23 9t9 23zm384-864v512q0 26-19 45t-45 19-45-19l-176-176-652 652q-10 10-23 10t-23-10l-114-114q-10-10-10-23t10-23l652-652-176-176q-19-19-19-45t19-45 45-19h512q26 0 45 19t19 45z"/></svg><!-- <img height="15" src="img/github-512.png" /> --></button>
<button onclick="viewModel.resourcesVisible(true); viewModel.appVisible(false); viewModel.cheatVisible(false)">Resources</button>
<button onclick="viewModel.cheatVisible(true); viewModel.appVisible(false); viewModel.resourcesVisible(false)">Cheat Sheet</button>
<button data-bind="click:wipeLocalStorage">Reset</button>
</div>
</div>
<hr />


<div id="welcome" data-bind="visible:welcomeVisible">
Expand All @@ -44,6 +37,18 @@ <h3>Welcome to the Stack&nbsp;Trainer.</h3>
<button data-bind="enable: (viewModel.stackChoice() !== 'Please choose a stack'), click:begin">Begin</button>
</div>


<div id="app" data-bind="visible: appVisible" >
<div class="menu">
<div id="buttonlist">
<button onclick="window.open('https://github.com/p44v9n/ko-stack-trainer', '_blank')">Contribute <svg class="external" width="14" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1408 928v320q0 119-84.5 203.5t-203.5 84.5h-832q-119 0-203.5-84.5t-84.5-203.5v-832q0-119 84.5-203.5t203.5-84.5h704q14 0 23 9t9 23v64q0 14-9 23t-23 9h-704q-66 0-113 47t-47 113v832q0 66 47 113t113 47h832q66 0 113-47t47-113v-320q0-14 9-23t23-9h64q14 0 23 9t9 23zm384-864v512q0 26-19 45t-45 19-45-19l-176-176-652 652q-10 10-23 10t-23-10l-114-114q-10-10-10-23t10-23l652-652-176-176q-19-19-19-45t19-45 45-19h512q26 0 45 19t19 45z"/></svg><!-- <img height="15" src="img/github-512.png" /> --></button>
<button onclick="viewModel.resourcesVisible(true); viewModel.appVisible(false); viewModel.cheatVisible(false)">Resources</button>
<button onclick="viewModel.cheatVisible(true); viewModel.appVisible(false); viewModel.resourcesVisible(false)">Cheat Sheet</button>
<button data-bind="click:wipeLocalStorage">Reset</button>
</div>
</div>
<hr />

<div id="cheat" class="panel" data-bind="visible:cheatVisible">
<a onClick="viewModel.appVisible(true); viewModel.cheatVisible(false)" class="closebutton"></a>
<h1>Cheat sheet for the <span data-bind="text:stackChoice"></span> Stack</h1>
Expand Down Expand Up @@ -257,8 +262,6 @@ <h1>Resources</h1>

</ul>
</div>

<div id="app" data-bind="visible: appVisible">
<!-- Question style A -->
<div data-bind="visible: questionStyleAVisible">
<p>At what position is the <span data-bind="text:currentCardValue"></span> of <span data-bind="text:currentCardSuit"></span>?</p>
Expand Down
5 changes: 3 additions & 2 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function newQuestion(){


// take card from bank
var x = viewModel.currentBank.shift();
var x = viewModel.currentBank()[0];

// set position, value and suit of this card
viewModel.currentCardPosition(x);
Expand Down Expand Up @@ -279,12 +279,12 @@ function calcscores(){

// update bank
if ((percentageCorrect > 0.9) || viewModel.scores()[x][2]>3) { // if streak >= 4 or percentage > 90%
viewModel.currentBank.shift();
if (viewModel.untested() !== []){
var bob = viewModel.untested.shift();
viewModel.currentBank.push(bob);
}
} else { // else readd current card
viewModel.currentBank.push(x);
}

// if bank empty add in first 7 again
Expand All @@ -300,6 +300,7 @@ function calcscores(){
shuffle(viewModel.currentBank());

// if same card comes to the front move it to the back, to avoid getting a duplicate question
// this is prob a silly way -- we should just re add back after
if (viewModel.currentBank()[0] === viewModel.currentCardPosition()){
var move = viewModel.currentBank.shift();
viewModel.currentBank.push(move);
Expand Down

0 comments on commit 00a9aa5

Please sign in to comment.