From ab564aef7b4ea33dd764cf8ccb2e8cc81650b51f Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 31 Aug 2012 17:33:22 +0400 Subject: [PATCH] filterEditDlg: automatically open new rule dialog when active feed or article title present --- classes/pref/filters.php | 3 --- js/functions.js | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/classes/pref/filters.php b/classes/pref/filters.php index 53f7d396..c91b190a 100644 --- a/classes/pref/filters.php +++ b/classes/pref/filters.php @@ -615,9 +615,6 @@ class Pref_Filters extends Handler_Protected { print "
"; - $active_feed_id = (int) db_escape_string($_REQUEST["feed"]); - $cat_filter = db_escape_string($_REQUEST["is_cat"]) == "true"; - print ""; print ""; print ""; diff --git a/js/functions.js b/js/functions.js index a01ce3ca..313cbe5c 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1169,6 +1169,27 @@ function quickAddFilter() { }, href: query}); + if (!inPreferences()) { + var lh = dojo.connect(dialog, "onLoad", function(){ + dojo.disconnect(lh); + + var title = $("PTITLE-FULL-" + active_post_id); + + if (title || getActiveFeedId() || activeFeedIsCat()) { + if (title) title = title.innerHTML; + + console.log(title + " " + getActiveFeedId()); + + var feed_id = activeFeedIsCat() ? 'CAT:' + parseInt(getActiveFeedId()) : + getActiveFeedId(); + + var rule = { reg_exp: title, feed_id: feed_id, filter_type: 1 }; + + addFilterRule(null, dojo.toJson(rule)); + } + }); + } + dialog.show(); } catch (e) { -- 2.39.5