Skip to content

Commit

Permalink
Improve pause/resume look/feel
Browse files Browse the repository at this point in the history
  • Loading branch information
OldManLink committed Feb 20, 2018
1 parent 47810e5 commit c3656ef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
14 changes: 5 additions & 9 deletions conway.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
var tContainer = document.getElementById('container');
tContainer.appendChild(getPanel());
tContainer.appendChild(getDrawerButton());
setPauseResumeText();
}

function getPanel()
Expand All @@ -19,7 +18,10 @@ function getPanel()
tPanel.id = 'panel';
if(tShowing) tPanel.classList.add('showing');
tPanel.appendChild(getStats());
tPanel.appendChild(getPauseButton());
if(!getConwayData('pause'))
{
tPanel.appendChild(getPauseButton());
}
return tPanel;
}

Expand Down Expand Up @@ -72,6 +74,7 @@ function getPauseButton()
{
var tPause = document.createElement('button');
tPause.id = 'conway_pause';
tPause.innerHTML = 'Pause';
tPause.addEventListener('click', pauseResume);
return tPause;
}
Expand All @@ -80,16 +83,9 @@ function pauseResume()
{
toggleConwayData('pause');
setConwayData('then', 0);
setPauseResumeText();
document.getElementById('theForm').submit();
}

function setPauseResumeText()
{
var tPauseButton = document.getElementById('conway_pause');
tPauseButton.innerHTML = getConwayData('pause') ? 'Resume' : 'Pause';
}

function removeDummyDrawerButton()
{
var tButton = document.getElementById('drawerHandle');
Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
if($pPaused)
{
print "$t[4]<div id='prompt' align=center>Please press<br>&quot;Resume&quot;<br>to continue.</div>\n";
print "$t[4]<button type='button' disabled id='conwaySubmit'>Guess</button>\n";
print "$t[4]<button type='button' id='conwaySubmit' onclick='pauseResume()'>Resume</button>\n";
}
else
{
Expand Down

0 comments on commit c3656ef

Please sign in to comment.