]> git.wh0rd.org - tt-rss.git/blobdiff - js/functions.js
remove PTITLE kludge; use ajax
[tt-rss.git] / js / functions.js
index db4fedcd52aa1f10d76bd2f513f29fca371c78f0..a9367da60704e4f14c00794adf087a135d3cfb9d 100644 (file)
@@ -1216,20 +1216,31 @@ function quickAddFilter() {
                        var lh = dojo.connect(dialog, "onLoad", function(){
                                dojo.disconnect(lh);
 
-                               var title = $("PTITLE-FULL-" + getActiveArticleId());
+                               var query = "op=rpc&method=getlinktitlebyid&id=" + getActiveArticleId();
 
-                               if (title || getActiveFeedId() || activeFeedIsCat()) {
-                                       if (title) title = title.innerHTML;
+                               new Ajax.Request("backend.php", {
+                               parameters: query,
+                               onComplete: function(transport) {
+                                       var reply = JSON.parse(transport.responseText);
 
-                                       console.log(title + " " + getActiveFeedId());
+                                       var title = false;
 
-                                       var feed_id = activeFeedIsCat() ? 'CAT:' + parseInt(getActiveFeedId()) :
-                                               getActiveFeedId();
+                                       if (reply && reply) title = reply.title;
 
-                                       var rule = { reg_exp: title, feed_id: feed_id, filter_type: 1 };
+                                       if (title || getActiveFeedId() || activeFeedIsCat()) {
+
+                                               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));
+                                       }
+
+                               } });
 
-                                       addFilterRule(null, dojo.toJson(rule));
-                               }
                        });
                }