1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-14 03:15:54 +00:00

allow adding labels on the fly

This commit is contained in:
Andrew Dolgov
2010-11-09 01:04:00 +03:00
parent ec16da866b
commit 1c31e1908a
3 changed files with 54 additions and 6 deletions

View File

@@ -1983,7 +1983,7 @@ function uploadFeedIcon() {
}
}
function addLabel() {
function addLabel(select, callback) {
try {
@@ -1999,14 +1999,19 @@ function addLabel() {
var query = "?op=pref-labels&subop=add&caption=" +
param_escape(caption);
if (select)
query += "&output=select";
notify_progress("Loading, please wait...", true);
if (inPreferences()) active_tab = "labelConfig";
if (inPreferences() && !select) active_tab = "labelConfig";
new Ajax.Request("backend.php", {
parameters: query,
onComplete: function(transport) {
if (inPreferences()) {
if (callback) {
callback(transport);
} else if (inPreferences()) {
infobox_submit_callback2(transport);
} else {
updateFeedList();
@@ -2232,3 +2237,31 @@ function genUrlChangeKey(feed, is_cat) {
return false;
}
function labelSelectOnChange(elem) {
try {
var value = elem[elem.selectedIndex].value;
var def = elem.getAttribute('default');
if (value == "ADD_LABEL") {
if (def)
dropboxSelect(elem, def);
else
elem.selectedIndex = 0;
addLabel(elem, function(transport) {
var response = transport.responseXML;
var payload = response.getElementsByTagName("payload")[0];
if (payload)
elem.innerHTML = payload.firstChild.nodeValue;
});
}
} catch (e) {
exception_error("catSelectOnChange", e);
}
}