]> git.wh0rd.org - tt-rss.git/blobdiff - js/functions.js
move inactiveFeeds and feedsWithErrors to pref-feeds; fix element id collisions
[tt-rss.git] / js / functions.js
index f2c5e3bf5f9cd1c7902bc7e7a4860099479d443c..97df318e530f8249305acfa06448585a4dbdfd8e 100644 (file)
@@ -953,9 +953,12 @@ function createNewRuleElement(parentNode, replaceNode) {
                                try {
                                        var li = dojo.create("li");
 
-                                       dojo.create("input", { type: "checkbox",
-                                               onclick: function() { toggleSelectListRow(this) },
-                                       }, li);
+                                       var cb = dojo.create("input", { type: "checkbox" }, li);
+
+                                       new dijit.form.CheckBox({
+                                               onChange: function() {
+                                                       toggleSelectListRow2(this) },
+                                       }, cb);
 
                                        dojo.create("input", { type: "hidden",
                                                name: "rule[]",
@@ -1000,9 +1003,12 @@ function createNewActionElement(parentNode, replaceNode) {
                                try {
                                        var li = dojo.create("li");
 
-                                       dojo.create("input", { type: "checkbox",
-                                               onclick: function() { toggleSelectListRow(this) },
-                                       }, li);
+                                       var cb = dojo.create("input", { type: "checkbox" }, li);
+
+                                       new dijit.form.CheckBox({
+                                               onChange: function() {
+                                                       toggleSelectListRow2(this) },
+                                       }, cb);
 
                                        dojo.create("input", { type: "hidden",
                                                name: "action[]",
@@ -1105,6 +1111,40 @@ function quickAddFilter() {
                        id: "filterEditDlg",
                        title: __("Create Filter"),
                        style: "width: 600px",
+                       test: function() {
+                               var query = "backend.php?" + dojo.formToQuery("filter_new_form") + "&savemode=test";
+
+                               if (dijit.byId("filterTestDlg"))
+                                       dijit.byId("filterTestDlg").destroyRecursive();
+
+                               var test_dlg = new dijit.Dialog({
+                                       id: "filterTestDlg",
+                                       title: "Test Filter",
+                                       style: "width: 600px",
+                                       href: query});
+
+                               test_dlg.show();
+                       },
+                       selectRules: function(select) {
+                               $$("#filterDlg_Matches input[type=checkbox]").each(function(e) {
+                                       e.checked = select;
+                                       if (select)
+                                               e.parentNode.addClassName("Selected");
+                                       else
+                                               e.parentNode.removeClassName("Selected");
+                               });
+                       },
+                       selectActions: function(select) {
+                               $$("#filterDlg_Actions input[type=checkbox]").each(function(e) {
+                                       e.checked = select;
+
+                                       if (select)
+                                               e.parentNode.addClassName("Selected");
+                                       else
+                                               e.parentNode.removeClassName("Selected");
+
+                               });
+                       },
                        editRule: function(e) {
                                var li = e.parentNode;
                                var rule = li.getElementsByTagName("INPUT")[1].value;
@@ -1143,6 +1183,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) {
@@ -1690,7 +1751,7 @@ function feedBrowser() {
 
 function showFeedsWithErrors() {
        try {
-               var query = "backend.php?op=dlg&method=feedsWithErrors";
+               var query = "backend.php?op=pref-feeds&method=feedsWithErrors";
 
                if (dijit.byId("errorFeedsDlg"))
                        dijit.byId("errorFeedsDlg").destroyRecursive();