]> git.wh0rd.org - tt-rss.git/blame - tt-rss.js
misc code cleanups
[tt-rss.git] / tt-rss.js
CommitLineData
1cd17194 1var xmlhttp = false;
76798ff3 2var total_unread = 0;
525116d4 3var first_run = true;
8143ae1f 4var display_tags = false;
806a3d14 5var global_unread = -1;
21703604 6var active_title_text = "";
21703604 7var current_subtitle = "";
c6784aea 8var daemon_enabled = false;
0d51e25d 9var daemon_refresh_only = false;
15da5cc1 10var _qfd_deleted_feed = 0;
2bf6e0a8 11var firsttime_update = true;
76b4eae1 12var cookie_lifetime = 0;
33d13e72 13var active_feed_id = 0;
0a6c4846 14var active_feed_is_cat = false;
9e397d0f 15var number_of_feeds = 0;
7a09510c 16var sanity_check_done = false;
15da5cc1 17
a58069db 18var xmlhttp = Ajax.getTransport();
1cd17194 19
1035fcec 20var init_params = new Object();
3ac2b520 21
0b126ac2
AD
22function tagsAreDisplayed() {
23 return display_tags;
24}
25
0979b696 26function toggleTags(show_all) {
8143ae1f 27
17a756d1
AD
28 try {
29
30 debug("toggleTags: " + show_all + "; " + display_tags);
31
8143ae1f
AD
32 var p = document.getElementById("dispSwitchPrompt");
33
0979b696
AD
34 if (!show_all && !display_tags) {
35 displayDlg("printTagCloud");
36 } else if (show_all) {
37 closeInfoBox();
38 display_tags = true;
709e7dc2 39 p.innerHTML = __("display feeds");
35a03bdd 40 notify_progress("Loading, please wait...", true);
0979b696
AD
41 updateFeedList();
42 } else if (display_tags) {
43 display_tags = false;
44 p.innerHTML = __("tag cloud");
35a03bdd 45 notify_progress("Loading, please wait...", true);
0979b696 46 updateFeedList();
8143ae1f 47 }
17a756d1
AD
48
49 } catch (e) {
50 exception_error("toggleTags", e);
51 }
8143ae1f
AD
52}
53
6de5d056 54function dlg_frefresh_callback() {
abbe0154 55 if (xmlhttp.readyState == 4) {
a58d997c 56// notify(xmlhttp.responseText);
abbe0154
AD
57
58 if (getActiveFeedId() == _qfd_deleted_feed) {
59 var h = document.getElementById("headlines-frame");
60 if (h) {
addb5836 61 h.innerHTML = "<div class='whiteBox'>" + __('No feed selected.') + "</div>";
abbe0154
AD
62 }
63 }
64
0e9dd1ba 65 setTimeout('updateFeedList(false, false)', 50);
eff4997c 66 closeInfoBox();
c0e5a40e 67 }
1cd17194 68}
e2f8f7b4 69
c20fd463
AD
70function refetch_callback2(transport) {
71 try {
c441662f 72
c20fd463 73 var date = new Date();
c441662f 74
c20fd463 75 parse_counters_reply(transport, true);
71ad883b 76
c20fd463 77 debug("refetch_callback2: done");
0ee1d1a0 78
c20fd463
AD
79 if (!daemon_enabled && !daemon_refresh_only) {
80 notify_info("All feeds updated.");
e2cb4c6d 81 updateTitle("");
c20fd463
AD
82 } else {
83 //notify("");
7719618b 84 }
c20fd463
AD
85 } catch (e) {
86 exception_error("refetch_callback", e);
87 updateTitle("");
090e250b
AD
88 }
89}
1a66d16e 90
295f9b42
AD
91function backend_sanity_check_callback() {
92
93 if (xmlhttp.readyState == 4) {
295f9b42 94
7719618b 95 try {
7a09510c
AD
96
97 if (sanity_check_done) {
81352b54
AD
98 fatalError(11, "Sanity check request received twice. This can indicate "+
99 "presence of Firebug or some other disrupting extension. "+
100 "Please disable it and try again.");
7a09510c
AD
101 return;
102 }
103
7719618b 104 if (!xmlhttp.responseXML) {
462a192b 105 fatalError(3, "[D001, Received reply is not XML]: " + xmlhttp.responseText);
7719618b
AD
106 return;
107 }
295f9b42 108
3ac2b520 109 var reply = xmlhttp.responseXML.firstChild.firstChild;
7719618b
AD
110
111 if (!reply) {
af106b0e 112 fatalError(3, "[D002, Invalid RPC reply]: " + xmlhttp.responseText);
7719618b
AD
113 return;
114 }
115
116 var error_code = reply.getAttribute("error-code");
117
118 if (error_code && error_code != 0) {
af106b0e 119 return fatalError(error_code, reply.getAttribute("error-msg"));
7719618b
AD
120 }
121
0ee1d1a0
AD
122 debug("sanity check ok");
123
3ac2b520
AD
124 var params = reply.nextSibling;
125
126 if (params) {
127 debug('reading init-params...');
128 var param = params.firstChild;
129
130 while (param) {
131 var k = param.getAttribute("key");
132 var v = param.getAttribute("value");
133 debug(k + " => " + v);
134 init_params[k] = v;
135 param = param.nextSibling;
136 }
137 }
138
7a09510c
AD
139 sanity_check_done = true;
140
7719618b 141 init_second_stage();
295f9b42 142
7719618b
AD
143 } catch (e) {
144 exception_error("backend_sanity_check_callback", e);
145 }
295f9b42
AD
146 }
147}
148
cb246176 149function scheduleFeedUpdate(force) {
525116d4 150
c20fd463
AD
151 debug("in scheduleFeedUpdate");
152
0d51e25d 153 if (!daemon_enabled && !daemon_refresh_only) {
c20fd463 154 notify_progress("Updating feeds...", true);
c6784aea 155 }
55193822 156
cb246176
AD
157 var query_str = "backend.php?op=rpc&subop=";
158
159 if (force) {
c3b81db0 160 query_str = query_str + "forceUpdateAllFeeds";
cb246176 161 } else {
c3b81db0 162 query_str = query_str + "updateAllFeeds";
cb246176 163 }
525116d4 164
9826bd2e
AD
165 var omode;
166
b6104dee 167 if (firsttime_update && !navigator.userAgent.match("Opera")) {
2bf6e0a8
AD
168 firsttime_update = false;
169 omode = "T";
9826bd2e 170 } else {
2bf6e0a8 171 if (display_tags) {
cf4d339c 172 omode = "tl";
2bf6e0a8
AD
173 } else {
174 omode = "flc";
175 }
9826bd2e 176 }
2bf6e0a8 177
9826bd2e 178 query_str = query_str + "&omode=" + omode;
78ea1de0 179 query_str = query_str + "&uctr=" + global_unread;
9826bd2e 180
c441662f 181 var date = new Date();
89fbb3bc
AD
182 var timestamp = Math.round(date.getTime() / 1000);
183 query_str = query_str + "&ts=" + timestamp
184
52db9978
AD
185 debug("REFETCH query: " + query_str);
186
c20fd463
AD
187 new Ajax.Request(query_str, {
188 onComplete: function(transport) {
189 refetch_callback2(transport);
190 } });
525116d4 191}
1cd17194 192
525116d4 193function updateFeedList(silent, fetch) {
c0e5a40e 194
1a66d16e
AD
195// if (silent != true) {
196// notify("Loading feed list...");
197// }
82baad4a 198
cf4d339c
AD
199 debug("<b>updateFeedList</b>");
200
331900c6
AD
201 var query_str = "backend.php?op=feeds";
202
8143ae1f
AD
203 if (display_tags) {
204 query_str = query_str + "&tags=1";
205 }
206
5c365f60 207 if (getActiveFeedId() && !activeFeedIsCat()) {
86741347 208 query_str = query_str + "&actid=" + getActiveFeedId();
175847de
AD
209 }
210
86173d9a
AD
211 var date = new Date();
212 var timestamp = Math.round(date.getTime() / 1000);
213 query_str = query_str + "&ts=" + timestamp
59b8192f 214
1a66d16e 215 if (fetch) query_str = query_str + "&fetch=yes";
e1123aee 216
6b4163cb
AD
217// var feeds_frame = document.getElementById("feeds-frame");
218// feeds_frame.src = query_str;
219
0e9dd1ba 220 debug("updateFeedList Q=" + query_str);
6b4163cb
AD
221
222 if (xmlhttp_ready(xmlhttp)) {
223 xmlhttp.open("GET", query_str, true);
224 xmlhttp.onreadystatechange=feedlist_callback;
225 xmlhttp.send(null);
226 } else {
227 debug("xmlhttp busy");
228 //printLockingError();
229 }
e1123aee 230
1a66d16e 231}
175847de 232
476cac42 233function catchupAllFeeds() {
076682aa 234
476cac42
AD
235 var query_str = "backend.php?op=feeds&subop=catchupAll";
236
42c32916 237 notify_progress("Marking all feeds as read...");
476cac42 238
ca2f46a7 239 debug("catchupAllFeeds Q=" + query_str);
1a66d16e 240
ca2f46a7
AD
241 if (xmlhttp_ready(xmlhttp)) {
242 xmlhttp.open("GET", query_str, true);
243 xmlhttp.onreadystatechange=feedlist_callback;
244 xmlhttp.send(null);
245 } else {
246 debug("xmlhttp busy");
247 //printLockingError();
248 }
476cac42 249
fc69e641 250 global_unread = 0;
21703604 251 updateTitle("");
fc69e641 252
476cac42 253}
1cd17194 254
767e2486 255function viewCurrentFeed(subop) {
1a66d16e 256
ec6e2fd3
AD
257// if (getActiveFeedId()) {
258 if (getActiveFeedId() != undefined) {
767e2486 259 viewfeed(getActiveFeedId(), subop);
033e47e0
AD
260 } else {
261 disableContainerChildren("headlinesToolbar", false, document);
ec6e2fd3 262// viewfeed(-1, subop); // FIXME
f0601b87 263 }
164f4738 264 return false; // block unneeded form submits
f0601b87
AD
265}
266
767e2486 267function viewfeed(feed, subop) {
db8d6f67 268 var f = window.frames["feeds-frame"];
767e2486 269 f.viewfeed(feed, subop);
9cfc649a
AD
270}
271
40d13c28 272function timeout() {
05732aa0 273 scheduleFeedUpdate(false);
f5de0d8d 274
3ac2b520 275 var refresh_time = getInitParam("feeds_frame_refresh");
f5de0d8d 276
3ac2b520 277 if (!refresh_time) refresh_time = 600;
f5de0d8d
AD
278
279 setTimeout("timeout()", refresh_time*1000);
ac53063a
AD
280}
281
c374a3fe 282function resetSearch() {
64c620ce
AD
283 var searchbox = document.getElementById("searchbox")
284
86741347 285 if (searchbox.value != "" && getActiveFeedId()) {
64c620ce 286 searchbox.value = "";
767e2486 287 viewfeed(getActiveFeedId(), "");
ac43eba1 288 }
c374a3fe 289}
ac53063a 290
86b682ce
AD
291function searchCancel() {
292 closeInfoBox(true);
293}
294
f0601b87 295function search() {
eff4997c 296 closeInfoBox();
4ce19859 297 viewCurrentFeed(0, "");
76798ff3 298}
1cd17194 299
13ad9102
AD
300function localPiggieFunction(enable) {
301 if (enable) {
302 var query_str = "backend.php?op=feeds&subop=piggie";
303
c0e5a40e 304 if (xmlhttp_ready(xmlhttp)) {
13ad9102
AD
305
306 xmlhttp.open("GET", query_str, true);
307 xmlhttp.onreadystatechange=feedlist_callback;
308 xmlhttp.send(null);
309 }
310 }
311}
312
806a3d14
AD
313// if argument is undefined, current subtitle is not updated
314// use blank string to clear subtitle
fc69e641
AD
315function updateTitle(s) {
316 var tmp = "Tiny Tiny RSS";
21703604 317
5a494a0b 318 if (s != undefined) {
21703604
AD
319 current_subtitle = s;
320 }
321
fc69e641
AD
322 if (global_unread > 0) {
323 tmp = tmp + " (" + global_unread + ")";
324 }
325
5a494a0b 326 if (current_subtitle) {
21703604 327 tmp = tmp + " - " + current_subtitle;
fc69e641 328 }
21703604
AD
329
330 if (active_title_text.length > 0) {
331 tmp = tmp + " > " + active_title_text;
332 }
333
fc69e641
AD
334 document.title = tmp;
335}
336
22a93ad8 337function genericSanityCheck() {
ac43eba1 338
295f9b42
AD
339 if (!xmlhttp) fatalError(1);
340
341 setCookie("ttrss_vf_test", "TEST");
342
343 if (getCookie("ttrss_vf_test") != "TEST") {
344 fatalError(2);
345 }
346
22a93ad8
AD
347 return true;
348}
349
350function init() {
351
7719618b 352 try {
fe2f1970 353
97dcd654
AD
354 // this whole shebang is based on http://www.birnamdesigns.com/misc/busted2.html
355
356 if (arguments.callee.done) return;
357 arguments.callee.done = true;
358
7719618b 359 disableContainerChildren("headlinesToolbar", true);
70830c87 360
86b682ce
AD
361 Form.disable("main_toolbar_form");
362
7719618b
AD
363 if (!genericSanityCheck())
364 return;
ac43eba1 365
0ee1d1a0
AD
366 if (getURLParam('debug')) {
367 document.getElementById('debug_output').style.display = 'block';
368 debug('debug mode activated');
369 }
370
4220d6b0
AD
371 var params = "&ua=" + param_escape(navigator.userAgent);
372
373 xmlhttp.open("GET", "backend.php?op=rpc&subop=sanityCheck" + params, true);
7719618b
AD
374 xmlhttp.onreadystatechange=backend_sanity_check_callback;
375 xmlhttp.send(null);
47179952 376
7719618b
AD
377 } catch (e) {
378 exception_error("init", e);
a8d28f48 379 }
7719618b 380}
86741347 381
a9d42cf7 382function resize_headlines() {
770bbb02 383
a9d42cf7
AD
384 var h_frame = document.getElementById("headlines-frame");
385 var c_frame = document.getElementById("content-frame");
586822fd
AD
386 var f_frame = document.getElementById("footer");
387
388 if (!c_frame || !h_frame) return;
a9d42cf7
AD
389
390 debug("resize_headlines");
391
586822fd 392 if (!is_msie()) {
a9d42cf7
AD
393 h_frame.style.height = 30 + "%";
394 c_frame.style.top = h_frame.offsetTop + h_frame.offsetHeight + 1 + "px";
395 h_frame.style.height = h_frame.offsetHeight + "px";
586822fd
AD
396 } else {
397 h_frame.style.height = document.documentElement.clientHeight * 0.3 + "px";
398 c_frame.style.top = h_frame.offsetTop + h_frame.offsetHeight + 1 + "px";
399
400 var c_bottom = document.documentElement.clientHeight;
401
402 if (f_frame) {
403 c_bottom = f_frame.offsetTop;
404 }
405
406 c_frame.style.height = c_bottom - (h_frame.offsetTop +
407 h_frame.offsetHeight + 1) + "px";
408 h_frame.style.height = h_frame.offsetHeight + "px";
409
a9d42cf7
AD
410 }
411}
412
7719618b 413function init_second_stage() {
295f9b42 414
7719618b 415 try {
2f587484 416
76b4eae1
AD
417 cookie_lifetime = getCookie("ttrss_cltime");
418
419 delCookie("ttrss_vf_test");
770bbb02 420
586822fd
AD
421// document.onresize = resize_headlines;
422 resize_headlines();
1b0809ae 423
40496720 424 var toolbar = document.forms["main_toolbar_form"];
f31673f7 425
40496720
AD
426 dropboxSelect(toolbar.view_mode, getInitParam("default_view_mode"));
427 dropboxSelect(toolbar.limit, getInitParam("default_view_limit"));
c6784aea 428
0d51e25d
AD
429 daemon_enabled = getInitParam("daemon_enabled") == 1;
430 daemon_refresh_only = getInitParam("daemon_refresh_only") == 1;
5f136c9a 431
0e9dd1ba 432 setTimeout('updateFeedList(false, false)', 50);
0ee1d1a0
AD
433
434 debug("second stage ok");
7719618b 435
7719618b
AD
436 } catch (e) {
437 exception_error("init_second_stage", e);
2f587484 438 }
1cd17194 439}
ac43eba1 440
c09ec856 441function quickMenuChange() {
cbe45fa8 442 var chooser = document.getElementById("quickMenuChooser");
86b682ce 443 var opid = chooser[chooser.selectedIndex].value;
e2f8f7b4 444
c09ec856
AD
445 chooser.selectedIndex = 0;
446 quickMenuGo(opid);
447}
448
449function quickMenuGo(opid) {
bb3423cf 450 try {
c09ec856 451
bb3423cf
AD
452 if (opid == "qmcPrefs") {
453 gotoPreferences();
454 }
455
456 if (opid == "qmcSearch") {
0a6c4846 457 displayDlg("search", getActiveFeedId() + ":" + activeFeedIsCat());
6de5d056
AD
458 return;
459 }
bb3423cf
AD
460
461 if (opid == "qmcAddFeed") {
462 displayDlg("quickAddFeed");
463 return;
69668465 464 }
7086277c
AD
465
466 if (opid == "qmcEditFeed") {
467 editFeedDlg(getActiveFeedId());
468 }
6de5d056 469
bb3423cf
AD
470 if (opid == "qmcRemoveFeed") {
471 var actid = getActiveFeedId();
442d77f1
AD
472
473 if (activeFeedIsCat()) {
89cb787e 474 alert(__("You can't unsubscribe from the category."));
442d77f1
AD
475 return;
476 }
477
478 if (!actid) {
89cb787e 479 alert(__("Please select some feed first."));
bb3423cf
AD
480 return;
481 }
64a2875d
AD
482
483 var fn = getFeedName(actid);
89cb787e
AD
484
485 var pr = __("Unsubscribe from %s?").replace("%s", fn);
486
487 if (confirm(pr)) {
bb3423cf
AD
488 qfdDelete(actid);
489 }
490
491 return;
492 }
493
494 if (opid == "qmcUpdateFeeds") {
495 scheduleFeedUpdate(true);
496 return;
497 }
498
499 if (opid == "qmcCatchupAll") {
500 catchupAllFeeds();
501 return;
502 }
503
504 if (opid == "qmcShowOnlyUnread") {
505 toggleDispRead();
506 return;
507 }
508
509 if (opid == "qmcAddFilter") {
510 displayDlg("quickAddFilter", getActiveFeedId());
511 }
0979b696 512
bb3423cf
AD
513 } catch (e) {
514 exception_error("quickMenuGo", e);
a24f525c 515 }
e2f8f7b4
AD
516}
517
6de5d056
AD
518function qfdDelete(feed_id) {
519
42c32916 520 notify_progress("Removing feed...");
6de5d056 521
7f123cda
AD
522 if (!xmlhttp_ready(xmlhttp)) {
523 printLockingError();
524 return
525 }
526
15da5cc1
AD
527 _qfd_deleted_feed = feed_id;
528
69668465 529 xmlhttp.open("GET", "backend.php?op=pref-feeds&quiet=1&subop=remove&ids=" + feed_id);
6de5d056
AD
530 xmlhttp.onreadystatechange=dlg_frefresh_callback;
531 xmlhttp.send(null);
7bc4f251
AD
532
533 return false;
6de5d056 534}
033e47e0 535
3745788e 536
21703604
AD
537function updateFeedTitle(t) {
538 active_title_text = t;
539 updateTitle();
540}
541
3745788e 542function toggleDispRead() {
7f123cda 543 try {
3745788e 544
7f123cda
AD
545 if (!xmlhttp_ready(xmlhttp)) {
546 printLockingError();
547 return
5158ced9 548 }
3745788e 549
e8bd0da9 550 var hide_read_feeds = (getInitParam("hide_read_feeds") == "1");
3745788e 551
7f123cda 552 hide_read_feeds = !hide_read_feeds;
e8bd0da9
AD
553
554 debug("toggle_disp_read => " + hide_read_feeds);
555
556 hideOrShowFeeds(getFeedsContext().document, hide_read_feeds);
557
e8bd0da9
AD
558 storeInitParam("hide_read_feeds", hide_read_feeds, true);
559
5158ced9
AD
560/* var query = "backend.php?op=rpc&subop=setpref" +
561 "&key=HIDE_READ_FEEDS&value=" + param_escape(hide_read_feeds);
562
563 new Ajax.Request(query); */
564
7f123cda
AD
565 } catch (e) {
566 exception_error("toggleDispRead", e);
3745788e 567 }
3745788e 568}
295f9b42 569
71ad883b 570function parse_runtime_info(elem) {
4724a093
AD
571 if (!elem) {
572 debug("parse_runtime_info: elem is null, aborting");
573 return;
574 }
575
71ad883b
AD
576 var param = elem.firstChild;
577
52db9978 578 debug("parse_runtime_info: " + param);
1cb7492d 579
71ad883b
AD
580 while (param) {
581 var k = param.getAttribute("key");
582 var v = param.getAttribute("value");
3ac2b520 583
1cb7492d
AD
584 debug("RI: " + k + " => " + v);
585
d9fa39f1
AD
586 if (k == "new_version_available") {
587 var icon = document.getElementById("newVersionIcon");
588 if (icon) {
589 if (v == "1") {
590 icon.style.display = "inline";
591 } else {
592 icon.style.display = "none";
593 }
594 }
595 }
596
8e00ae9b
AD
597 var error_flag;
598
ef16ae37 599 if (k == "daemon_is_running" && v != 1) {
8e00ae9b
AD
600 notify_error("<span onclick=\"javascript:explainError(1)\">Update daemon is not running.</span>", true);
601 error_flag = true;
602 }
603
604 if (k == "daemon_stamp_ok" && v != 1) {
605 notify_error("<span onclick=\"javascript:explainError(3)\">Update daemon is not updating feeds.</span>", true);
606 error_flag = true;
607 }
608
609 if (!error_flag) {
d00bfb5f 610 notify('');
ef16ae37
AD
611 }
612
613/* var w = document.getElementById("noDaemonWarning");
71ad883b
AD
614
615 if (w) {
616 if (k == "daemon_is_running" && v != 1) {
617 w.style.display = "block";
618 } else {
619 w.style.display = "none";
620 }
ef16ae37 621 } */
71ad883b
AD
622 param = param.nextSibling;
623 }
624}
fce24838
AD
625
626function catchupCurrentFeed() {
627
234e467c 628 var fn = getFeedName(getActiveFeedId(), active_feed_is_cat);
fce24838 629
234e467c
AD
630 var str = "Mark all articles in " + fn + " as read?";
631
632/* if (active_feed_is_cat) {
633 str = "Mark all articles in this category as read?";
634 } */
635
f6d6e22f 636 if (getInitParam("confirm_feed_catchup") != 1 || confirm(str)) {
28de3732 637 return viewCurrentFeed('MarkAllRead')
fce24838
AD
638 }
639}
88040f57 640
461766f3
AD
641function userSwitch() {
642 var chooser = document.getElementById("userSwitch");
643 var user = chooser[chooser.selectedIndex].value;
644 window.location = "tt-rss.php?swu=" + user;
645}
6e6504bc 646
7086277c
AD
647function editFeedDlg(feed) {
648
729bafaa
AD
649 disableHotkeys();
650
7086277c 651 if (!feed) {
89cb787e 652 alert(__("Please select some feed first."));
7086277c
AD
653 return;
654 }
655
6f151277 656 if ((feed <= 0 && feed > -10) || activeFeedIsCat() || tagsAreDisplayed()) {
89cb787e 657 alert(__("You can't edit this kind of feed."));
92f3bcae
AD
658 return;
659 }
660
7086277c 661 if (xmlhttp_ready(xmlhttp)) {
6f151277
AD
662
663 if (feed > 0) {
664 xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editfeed&id=" +
665 param_escape(feed), true);
666 xmlhttp.onreadystatechange=infobox_callback;
667 xmlhttp.send(null);
668 } else {
669 xmlhttp.open("GET", "backend.php?op=pref-labels&subop=edit&id=" +
670 param_escape(-feed-11), true);
671 xmlhttp.onreadystatechange=infobox_callback;
672 xmlhttp.send(null);
673 }
7086277c
AD
674 } else {
675 printLockingError();
676 }
677}
678
679/* this functions duplicate those of prefs.js feed editor, with
680 some differences because there is no feedlist */
681
682function feedEditCancel() {
683 closeInfoBox();
684 return false;
685}
686
687function feedEditSave() {
688
689 try {
690
691 if (!xmlhttp_ready(xmlhttp)) {
692 printLockingError();
693 return
694 }
695
696 // FIXME: add parameter validation
697
698 var query = Form.serialize("edit_feed_form");
699
42c32916 700 notify_progress("Saving feed...");
7086277c
AD
701
702 xmlhttp.open("POST", "backend.php", true);
703 xmlhttp.onreadystatechange=dlg_frefresh_callback;
704 xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
705 xmlhttp.send(query);
706
707 closeInfoBox();
708
709 return false;
710
711 } catch (e) {
712 exception_error("feedEditSave (main)", e);
713 }
714}
1dc8dba0 715
6f151277
AD
716function labelEditCancel() {
717 closeInfoBox();
718 return false;
719}
720
721function labelEditSave() {
722
723 try {
724
725 if (!xmlhttp_ready(xmlhttp)) {
726 printLockingError();
727 return
728 }
729
730 closeInfoBox();
731
732 notify_progress("Saving label...");
733
734 query = Form.serialize("label_edit_form");
735
736 xmlhttp.open("GET", "backend.php?" + query, true);
737 xmlhttp.onreadystatechange=dlg_frefresh_callback;
738 xmlhttp.send(null);
739
740 return false;
741
742 } catch (e) {
743 exception_error("feedEditSave (main)", e);
744 }
745
746}
e4914b62 747