From aad2f4a3e0f8893e792a4c3af237328a7a725d98 Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Wed, 6 Jul 2011 23:04:46 +0200 Subject: [PATCH] displaying characters is optional and off by default --- star.js/js/star.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/star.js/js/star.js b/star.js/js/star.js index b082ba1..5b6a792 100644 --- a/star.js/js/star.js +++ b/star.js/js/star.js @@ -95,7 +95,7 @@ function won_or_not( state ) { return count_gifts( state ) === 0; } -function format_level( state ) { +function format_level( state, text ) { function Replacer( conversionObject ) { var regexpStr = ''; @@ -119,6 +119,11 @@ function format_level( state ) { '@': '@' }; substitutions[ state.moving ] = substitutions[ state.moving ].replace( '">', '_selected">' ); + if ( text == false ) { + for ( var c in substitutions ) { + substitutions[ c ] = substitutions[ c ].replace( />.<' ); + } + } var myReplacer = Replacer( substitutions ); return myReplacer( state.board ); } @@ -132,7 +137,7 @@ function load_level( levelset, nb ) { } function display_level( state, elt ) { - $( elt ).html( format_level( state ) ); + $( elt ).html( format_level( state, false ) ); }