From 9f739c7f04b23ea969b6055d745327d09c49291c Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Wed, 13 Jul 2011 16:49:47 +0200 Subject: [PATCH] refactor display code, only refresh changed elements --- js/star.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/js/star.js b/js/star.js index a940165..512e288 100644 --- a/js/star.js +++ b/js/star.js @@ -146,12 +146,8 @@ function format_help( ) { } function display_level( state, elt ) { - var starhtml = '
'; - starhtml += ''; - starhtml += '
' + format_level( state, false ) + '
'; - starhtml += ''; - starhtml += '
'; - $( 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 = '
'; + starhtml += ''; + starhtml += '
'; + starhtml += ''; + starhtml += '
'; + $( elt ).html( starhtml ); + state = load_level( levels, 0 ); start_loop( state, elt ); }