From 269ff0028dcbdeefcfa46cd168d6fbc4e2499fc2 Mon Sep 17 00:00:00 2001 From: Stefan Matheis Date: Sat, 28 Apr 2012 08:32:52 +0000 Subject: [PATCH] SOLR-3238: Persist State of Verbose-Setting on Analysis git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1331706 13f79535-47bb-0310-9956-ffa450edef68 --- solr/webapp/web/js/scripts/analysis.js | 56 ++++++++++++++++++-------- 1 file changed, 39 insertions(+), 17 deletions(-) diff --git a/solr/webapp/web/js/scripts/analysis.js b/solr/webapp/web/js/scripts/analysis.js index dbbaa112a36..296af99eb5c 100644 --- a/solr/webapp/web/js/scripts/analysis.js +++ b/solr/webapp/web/js/scripts/analysis.js @@ -15,6 +15,8 @@ limitations under the License. */ +var cookie_name = 'analysis_verbose'; + // #/:core/analysis sammy.get ( @@ -160,23 +162,6 @@ sammy.get } ); - $( '.verbose_output a', analysis_element ) - .die( 'click' ) - .live - ( - 'click', - function( event ) - { - $( this ).parent() - .toggleClass( 'active' ); - - analysis_result - .toggleClass( 'verbose_output' ); - - check_empty_spacer(); - } - ); - var check_empty_spacer = function() { var spacer_holder = $( 'td.part.data.spacer .holder', analysis_result ); @@ -207,6 +192,43 @@ sammy.get } ); } + + var verbose_link = $( '.verbose_output a', analysis_element ); + + verbose_link + .die( 'toggle' ) + .live + ( + 'toggle', + function( event ) + { + $( this ).parent() + .toggleClass( 'active' ); + + analysis_result + .toggleClass( 'verbose_output' ); + + check_empty_spacer(); + } + ) + .die( 'click' ) + .live + ( + 'click', + function( event ) + { + $.cookie( cookie_name, $.cookie( cookie_name ) ? null : true ); + + $( this ) + .trigger( 'toggle' ); + } + ); + + if( $.cookie( cookie_name ) ) + { + verbose_link + .trigger( 'toggle' ); + } var button = $( 'button', analysis_form )