1
0
mirror of https://tt-rss.org/git/tt-rss.git synced 2024-06-25 11:57:42 +02:00

prefs: some async work (5)

This commit is contained in:
Andrew Dolgov 2009-01-24 08:44:29 +01:00
parent 23e51f4092
commit e9802eadd8

108
prefs.js
View File

@ -24,32 +24,30 @@ function infobox_submit_callback() {
} }
function replace_pubkey_callback() { function replace_pubkey_callback(transport) {
if (xmlhttp.readyState == 4) { try {
try { var link = document.getElementById("pubGenAddress");
var link = document.getElementById("pubGenAddress");
if (xmlhttp.responseXML) { if (transport.responseXML) {
var new_link = xmlhttp.responseXML.getElementsByTagName("link")[0]; var new_link = transport.responseXML.getElementsByTagName("link")[0];
if (new_link) { if (new_link) {
link.href = new_link.firstChild.nodeValue; link.href = new_link.firstChild.nodeValue;
//link.innerHTML = new_link.firstChild.nodeValue; //link.innerHTML = new_link.firstChild.nodeValue;
new Effect.Highlight(link); new Effect.Highlight(link);
notify_info("Published feed URL changed.");
} else {
notify_error("Could not change feed URL.");
}
notify_info("Published feed URL changed.");
} else { } else {
notify_error("Could not change feed URL."); notify_error("Could not change feed URL.");
} }
} catch (e) {
exception_error("replace_pubkey_callback", e); } else {
notify_error("Could not change feed URL.");
} }
} catch (e) {
exception_error("replace_pubkey_callback", e);
} }
} }
@ -129,15 +127,6 @@ function labellist_callback2(transport) {
} }
} }
function feed_browser_callback() {
var container = document.getElementById('prefContent');
if (xmlhttp.readyState == 4) {
container.innerHTML=xmlhttp.responseText;
notify("");
remove_splash();
}
}
function userlist_callback() { function userlist_callback() {
var container = document.getElementById('prefContent'); var container = document.getElementById('prefContent');
if (xmlhttp.readyState == 4) { if (xmlhttp.readyState == 4) {
@ -147,22 +136,14 @@ function userlist_callback() {
} }
} }
function prefslist_callback() { function prefslist_callback2(transport) {
var container = document.getElementById('prefContent'); try {
if (xmlhttp.readyState == 4) { var container = document.getElementById('prefContent');
container.innerHTML=xmlhttp.responseText; container.innerHTML=transport.responseText;
notify(""); notify("");
remove_splash(); remove_splash();
} } catch (e) {
} exception_error("prefslist_callback2", e);
function gethelp_callback() {
var container = document.getElementById('prefHelpBox');
if (xmlhttp.readyState == 4) {
container.innerHTML = xmlhttp.responseText;
container.style.display = "block";
} }
} }
@ -176,11 +157,13 @@ function notify_callback2(transport) {
notify_info(transport.responseText); notify_info(transport.responseText);
} }
function prefs_reset_callback() { function prefs_reset_callback2(transport) {
if (xmlhttp.readyState == 4) { try {
notify_info(xmlhttp.responseText); notify_info(transport.responseText);
selectTab(); selectTab();
} } catch (e) {
exception_error("prefs_reset_callback2", e);
}
} }
@ -1061,14 +1044,12 @@ function updateLabelList(sort_key) {
function updatePrefsList() { function updatePrefsList() {
if (!xmlhttp_ready(xmlhttp)) { var query = "backend.php?op=pref-prefs";
printLockingError();
return
}
xmlhttp.open("GET", "backend.php?op=pref-prefs", true); new Ajax.Request(query, {
xmlhttp.onreadystatechange=prefslist_callback; onComplete: function(transport) {
xmlhttp.send(null); prefslist_callback2(transport);
} });
} }
@ -1274,11 +1255,6 @@ function init() {
function categorizeSelectedFeeds() { function categorizeSelectedFeeds() {
if (!xmlhttp_ready(xmlhttp)) {
printLockingError();
return
}
var sel_rows = getSelectedFeeds(); var sel_rows = getSelectedFeeds();
var cat_sel = document.getElementById("sfeed_set_fcat"); var cat_sel = document.getElementById("sfeed_set_fcat");
@ -1314,10 +1290,12 @@ function validatePrefsReset() {
query = query + "&subop=reset-config"; query = query + "&subop=reset-config";
debug(query); debug(query);
xmlhttp.open("POST", "backend.php", true); new Ajax.Request("backend.php", {
xmlhttp.onreadystatechange=prefs_reset_callback; parameters: query,
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); onComplete: function(transport) {
xmlhttp.send(query); prefs_reset_callback2(transport);
} });
} }
} catch (e) { } catch (e) {
@ -1748,9 +1726,13 @@ function pubRegenKey() {
notify_progress("Trying to change address..."); notify_progress("Trying to change address...");
xmlhttp.open("GET", "backend.php?op=rpc&subop=regenPubKey"); var query = "backend.php?op=rpc&subop=regenPubKey";
xmlhttp.onreadystatechange=replace_pubkey_callback;
xmlhttp.send(null); new Ajax.Request(query, {
onComplete: function(transport) {
replace_pubkey_callback(transport);
} });
} }
return false; return false;