mirror of
https://github.com/gwenhael-le-moine/c-urs_-toil-s.git
synced 2024-12-26 09:58:48 +01:00
refactor display code, only refresh changed elements
This commit is contained in:
parent
aa465179f8
commit
ee96e8f271
1 changed files with 9 additions and 6 deletions
|
@ -146,12 +146,8 @@ function format_help( ) {
|
|||
}
|
||||
|
||||
function display_level( state, elt ) {
|
||||
var starhtml = '<div class="gstar">';
|
||||
starhtml += '<aside id="help">' + format_help( state ) + '</aside>';
|
||||
starhtml += '<div id="blackboard">' + format_level( state, false ) + '</div>';
|
||||
starhtml += '<aside id="infos">' + format_infos( state ) + '</aside>';
|
||||
starhtml += '</div>';
|
||||
$( elt ).html( starhtml );
|
||||
$( elt + " .gstar #blackboard" ).html( format_level( state, false ) );
|
||||
$( elt + " .gstar #infos" ).html( format_infos( state ) );
|
||||
}
|
||||
|
||||
function load_level( levelset, nb ) {
|
||||
|
@ -312,6 +308,13 @@ function start_loop( state, elt ) {
|
|||
}
|
||||
|
||||
function initialize_a_star( elt ) {
|
||||
var starhtml = '<div class="gstar">';
|
||||
starhtml += '<aside id="help">' + format_help( state ) + '</aside>';
|
||||
starhtml += '<div id="blackboard"></div>';
|
||||
starhtml += '<aside id="infos"></aside>';
|
||||
starhtml += '</div>';
|
||||
$( elt ).html( starhtml );
|
||||
|
||||
state = load_level( levels, 0 );
|
||||
start_loop( state, elt );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue