Skip to content

Instantly share code, notes, and snippets.

@matheusportela
Last active August 26, 2015 22:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matheusportela/5c16032bb4f8c54cde3c to your computer and use it in GitHub Desktop.
Save matheusportela/5c16032bb4f8c54cde3c to your computer and use it in GitHub Desktop.
function printControls(){
var controls = $('<div></div>')
.attr('id', 'controls')
.append(
$('<button></button>').text( 'rodar uma geração' ).attr( 'id', 'ciclo' )
)
.click( function(){
cycle();
});
$( cfg.screen ).append(controls);
var run = $('<div></div>')
.attr('id', 'controls')
.append(
$('<button></button>').text( 'rodar' ).attr('class', 'run_button').attr('id', 'ciclo')
)
.click( function() {
$('button.run_button').toggleClass('started');
if ($('button.run_button').text() == 'rodar')
$('button.run_button').text('parar');
else
$('button.run_button').text('rodar');
});
$( cfg.screen ).append(run);
window.setInterval(function(){
if ($('button.run_button').hasClass('started'))
cycle();
}, 1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment