Skip to content

Commit

Permalink
Fix issue with hide/show box content function. This ensures that defa…
Browse files Browse the repository at this point in the history
…ult state is aknowladged and ignored if cookie exists.
  • Loading branch information
Jackysi committed Mar 9, 2015
1 parent ecb3aeb commit f00621a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions js/advancedtomato.js
Expand Up @@ -246,11 +246,19 @@ function loadPage(page, variables) {

var id = $(this).attr('data-box');
var parent = $(this);
var status = (((hs_cook = cookie.get(id + '_visibility')) != null) && (hs_cook != '1') || !$(this).is(':visible')) ? false : true;
var status = (((hs_cook = cookie.get(id + '_visibility')) != null && (hs_cook != '1')) && $(this).is(':visible')) ? false : true;
var html = $('<a class="pull-right" href="#" data-toggle="tooltip" title="Hide/Show"><i class="icon-chevron-' + ((status) ? 'down' : 'up') + '"></i></a>');

// Hide if hidden
if (!status) { $(this).find('.content').hide(); }
if (status) {

$(this).find('.content').show();

} else { // Set display property no matter the preference (fixes defaults)

$(this).find('.content').hide();

}

// Now click handler
$(html).on('click', function() {
Expand Down

0 comments on commit f00621a

Please sign in to comment.