From: Andrew Dolgov Date: Fri, 31 Aug 2012 13:33:22 +0000 (+0400) Subject: filterEditDlg: automatically open new rule dialog when active feed or article title... X-Git-Tag: 1.6.0~89 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=ab564aef7b4ea33dd764cf8ccb2e8cc81650b51f;p=tt-rss.git filterEditDlg: automatically open new rule dialog when active feed or article title present --- 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) {