]> git.wh0rd.org - tt-rss.git/blobdiff - js/functions.js
filterEditDlg: automatically open new rule dialog when active feed or article title...
[tt-rss.git] / js / functions.js
index a01ce3cad01abcb89cd06c369f7ff6d140efc90b..313cbe5c9bbf98819469dbc4a74b3c2a59fe3adf 100644 (file)
@@ -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) {