diff options
author | gorhill <rhill@raymondhill.net> | 2015-03-14 14:12:05 -0400 |
---|---|---|
committer | gorhill <rhill@raymondhill.net> | 2015-03-14 14:12:05 -0400 |
commit | ed88939a63a46ba0c46346de5203e728e99bf8c5 (patch) | |
tree | 62d71bdb3b18b7608c04cec61b0cd0024409eef7 /src/js/3p-filters.js | |
parent | 6312e98cfe0fcff2a3d9544ac16dae633b6bbb1c (diff) | |
download | uBlock-ed88939a63a46ba0c46346de5203e728e99bf8c5.zip uBlock-ed88939a63a46ba0c46346de5203e728e99bf8c5.tar.gz uBlock-ed88939a63a46ba0c46346de5203e728e99bf8c5.tar.bz2 |
this fixes #792
Diffstat (limited to 'src/js/3p-filters.js')
-rw-r--r-- | src/js/3p-filters.js | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/js/3p-filters.js b/src/js/3p-filters.js index 276706e..b5daf83 100644 --- a/src/js/3p-filters.js +++ b/src/js/3p-filters.js @@ -185,7 +185,7 @@ var renderFilterLists = function() { hasCachedContent = false; // Visually split the filter lists in purpose-based groups - var ulLists = uDom('#lists').empty(); + var ulLists = uDom('#lists').empty(), liGroup; var groups = groupsFromLists(details.available); var groupKey, i; var groupKeys = [ @@ -200,7 +200,12 @@ var renderFilterLists = function() { ]; for ( i = 0; i < groupKeys.length; i++ ) { groupKey = groupKeys[i]; - ulLists.append(liFromListGroup(groupKey, groups[groupKey])); + liGroup = liFromListGroup(groupKey, groups[groupKey]); + liGroup.toggleClass( + 'collapsed', + vAPI.localStorage.getItem('collapseGroup' + (i + 1)) === 'y' + ); + ulLists.append(liGroup); delete groups[groupKey]; } // For all groups not covered above (if any left) @@ -485,6 +490,19 @@ var externalListsApplyHandler = function() { /******************************************************************************/ +var groupEntryClickHandler = function() { + var li = uDom(this).ancestors('.groupEntry'); + li.toggleClass('collapsed'); + var key = 'collapseGroup' + li.nthOfType(); + if ( li.hasClass('collapsed') ) { + vAPI.localStorage.setItem(key, 'y'); + } else { + vAPI.localStorage.removeItem(key); + } +}; + +/******************************************************************************/ + uDom.onLoad(function() { uDom('#autoUpdate').on('change', autoUpdateCheckboxChanged); uDom('#parseCosmeticFilters').on('change', cosmeticSwitchChanged); @@ -496,6 +514,7 @@ uDom.onLoad(function() { uDom('#lists').on('click', 'span.purge', onPurgeClicked); uDom('#externalLists').on('input', externalListsChangeHandler); uDom('#externalListsApply').on('click', externalListsApplyHandler); + uDom('#lists').on('click', '.groupEntry > span', groupEntryClickHandler); renderFilterLists(); renderExternalLists(); |