mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-15 10:25:56 +00:00
unify create filter interface
This commit is contained in:
80
functions.js
80
functions.js
@@ -917,3 +917,83 @@ function center_element(e) {
|
||||
exception_error("center_element", e);
|
||||
}
|
||||
}
|
||||
|
||||
function displayDlg(id, param) {
|
||||
|
||||
if (!xmlhttp_ready(xmlhttp)) {
|
||||
printLockingError();
|
||||
return
|
||||
}
|
||||
|
||||
notify("");
|
||||
|
||||
xmlhttp.open("GET", "backend.php?op=dlg&id=" +
|
||||
param_escape(id) + "¶m=" + param_escape(param), true);
|
||||
xmlhttp.onreadystatechange=dlg_display_callback;
|
||||
xmlhttp.send(null);
|
||||
|
||||
disableHotkeys();
|
||||
}
|
||||
|
||||
function closeDlg() {
|
||||
var dlg = document.getElementById("infoBoxShadow");
|
||||
dlg.style.display = "none";
|
||||
enableHotkeys();
|
||||
}
|
||||
|
||||
function dlg_submit_callback() {
|
||||
if (xmlhttp.readyState == 4) {
|
||||
notify(xmlhttp.responseText);
|
||||
closeDlg();
|
||||
|
||||
// called from prefs, reload tab
|
||||
if (active_tab) {
|
||||
selectTab(active_tab, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function dlg_display_callback() {
|
||||
if (xmlhttp.readyState == 4) {
|
||||
var dlg = document.getElementById("infoBox");
|
||||
var dlg_s = document.getElementById("infoBoxShadow");
|
||||
|
||||
dlg.innerHTML = xmlhttp.responseText;
|
||||
dlg_s.style.display = "block";
|
||||
}
|
||||
}
|
||||
|
||||
function qaddFilter() {
|
||||
|
||||
if (!xmlhttp_ready(xmlhttp)) {
|
||||
printLockingError();
|
||||
return
|
||||
}
|
||||
|
||||
var regexp = document.getElementById("fadd_regexp");
|
||||
var match = document.getElementById("fadd_match");
|
||||
var feed = document.getElementById("fadd_feed");
|
||||
var action = document.getElementById("fadd_action");
|
||||
|
||||
if (regexp.value.length == 0) {
|
||||
notify("Missing filter expression.");
|
||||
} else {
|
||||
notify("Adding filter...");
|
||||
|
||||
var v_match = match[match.selectedIndex].text;
|
||||
var feed_id = feed[feed.selectedIndex].id;
|
||||
var action_id = action[action.selectedIndex].id;
|
||||
|
||||
xmlhttp.open("GET", "backend.php?op=pref-filters&quiet=1&subop=add®exp=" +
|
||||
param_escape(regexp.value) + "&match=" + v_match +
|
||||
"&fid=" + param_escape(feed_id) + "&aid=" + param_escape(action_id), true);
|
||||
|
||||
xmlhttp.onreadystatechange=dlg_submit_callback;
|
||||
xmlhttp.send(null);
|
||||
|
||||
regexp.value = "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user