From fc847121352d4b0e54e046473420d35cac255a62 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 5 Jun 2022 11:41:28 +0300 Subject: pref-filters: add a button to hide or show rules in the filter list --- js/PrefFilterTree.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'js') diff --git a/js/PrefFilterTree.js b/js/PrefFilterTree.js index fff58ff1a..d4496b647 100644 --- a/js/PrefFilterTree.js +++ b/js/PrefFilterTree.js @@ -4,6 +4,13 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], function (declare, domConstruct) { return declare("fox.PrefFilterTree", lib.CheckBoxTree, { + postCreate: function() { + this.inherited(arguments); + + dijit.byId('filterTree').hideOrShowFilterRules( + parseInt(localStorage.getItem("ttrss:hide-filter-rules")) + ); + }, _createTreeNode: function(args) { const tnode = this.inherited(arguments); @@ -96,6 +103,16 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio Notify.close(); }); }, + hideOrShowFilterRules(hide) { + App.findAll("body")[0].setAttribute("hide-filter-rules", !!hide); + }, + toggleRules: function() { + const hide = !parseInt(localStorage.getItem("ttrss:hide-filter-rules")); + + this.hideOrShowFilterRules(hide); + + localStorage.setItem("ttrss:hide-filter-rules", hide ? 1 : 0); + }, resetFilterOrder: function() { Notify.progress("Loading, please wait..."); -- cgit v1.2.3