|
|
|
@ -19,8 +19,6 @@ const Filters = {
|
|
|
|
|
query = {op: "pref-filters", method: "edit", id: id};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
xhr.post("backend.php", query, function (reply) {
|
|
|
|
|
try {
|
|
|
|
|
const dialog = new fox.SingleUseDialog({
|
|
|
|
|
id: "filterEditDlg",
|
|
|
|
|
title: id ? __("Edit Filter") : __("Create Filter"),
|
|
|
|
@ -307,54 +305,46 @@ const Filters = {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
content: reply
|
|
|
|
|
content: __("Loading, please wait...")
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (!App.isPrefs()) {
|
|
|
|
|
/* global getSelectionText */
|
|
|
|
|
const selectedText = getSelectionText();
|
|
|
|
|
const tmph = dojo.connect(dialog, 'onShow', function () {
|
|
|
|
|
dojo.disconnect(tmph);
|
|
|
|
|
|
|
|
|
|
const lh = dojo.connect(dialog, "onShow", function () {
|
|
|
|
|
dojo.disconnect(lh);
|
|
|
|
|
xhr.post("backend.php", query, function (reply) {
|
|
|
|
|
dialog.attr('content', reply);
|
|
|
|
|
|
|
|
|
|
if (selectedText != "") {
|
|
|
|
|
if (!App.isPrefs()) {
|
|
|
|
|
const selectedText = App.getSelectedText();
|
|
|
|
|
|
|
|
|
|
if (selectedText != "") {
|
|
|
|
|
const feed_id = Feeds.activeIsCat() ? 'CAT:' + parseInt(Feeds.getActive()) :
|
|
|
|
|
Feeds.getActive();
|
|
|
|
|
|
|
|
|
|
const rule = {reg_exp: selectedText, feed_id: [feed_id], filter_type: 1};
|
|
|
|
|
|
|
|
|
|
dialog.editRule(null, dojo.toJson(rule));
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
const query = {op: "article", method: "getmetadatabyid", id: Article.getActive()};
|
|
|
|
|
|
|
|
|
|
xhr.json("backend.php", query, (reply) => {
|
|
|
|
|
let title = false;
|
|
|
|
|
let title;
|
|
|
|
|
|
|
|
|
|
if (reply && reply.title) title = reply.title;
|
|
|
|
|
|
|
|
|
|
if (title || Feeds.getActive() || Feeds.activeIsCat()) {
|
|
|
|
|
|
|
|
|
|
console.log(title + " " + Feeds.getActive());
|
|
|
|
|
|
|
|
|
|
const feed_id = Feeds.activeIsCat() ? 'CAT:' + parseInt(Feeds.getActive()) :
|
|
|
|
|
Feeds.getActive();
|
|
|
|
|
|
|
|
|
|
const rule = {reg_exp: title, feed_id: [feed_id], filter_type: 1};
|
|
|
|
|
|
|
|
|
|
dialog.editRule(null, dojo.toJson(rule));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
dialog.show();
|
|
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
App.Error.report(e);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
dialog.show();
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|