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