diff --git a/docs/script.js b/docs/script.js index 7f85b518..2ff3d940 100644 --- a/docs/script.js +++ b/docs/script.js @@ -84,12 +84,25 @@ $(document).ready(function() { } }); - // Set the "All Feeds" checkbox to checked when the page loads - $('#all-feeds').prop('checked', true); + // Check localStorage for the "all-feeds" key value on page load + var allFeedsValue = localStorage.getItem('all-feeds'); + if (allFeedsValue === "true") { + $('#all-feeds').prop('checked', true); + } else if (allFeedsValue === "false") { + $('#all-feeds').prop('checked', false); + checkboxes.each(function() { + $(this).prop('checked', false); + $('.' + $(this).attr('id')).hide(); + }); + } else { + localStorage.setItem('all-feeds', "true"); + $('#all-feeds').prop('checked', true); + } // Add event listener for "All Feeds" checkbox $('#all-feeds').click(function() { var isChecked = $(this).prop('checked'); + localStorage.setItem('all-feeds', isChecked); $('.feed-checkbox').each(function() { $(this).prop('checked', isChecked); if (isChecked) {