]>
git.wh0rd.org - tt-rss.git/blob - functions.js
1 var hotkeys_enabled
= true;
2 var notify_silent
= false;
3 var last_progress_point
= 0;
4 var async_counters_work
= false;
5 var sanity_check_done
= false;
7 /* add method to remove element from array */
9 Array
.prototype.remove = function(s
) {
10 for (var i
=0; i
< this.length
; i
++) {
11 if (s
== this[i
]) this.splice(i
, 1);
15 /* create console.log if it doesn't exist */
17 if (!window
.console
) console
= {};
18 console
.log
= console
.log
|| function(msg
) { debug(msg
); };
19 console
.warn
= console
.warn
|| function(msg
) { debug(msg
); };
20 console
.error
= console
.error
|| function(msg
) { debug(msg
); };
22 function exception_error(location
, e
, ext_info
) {
23 var msg
= format_exception_error(location
, e
);
25 if (!ext_info
) ext_info
= false;
31 var ebc
= $("xebContent");
35 Element
.show("dialog_overlay");
36 Element
.show("errorBoxShadow");
39 if (ext_info
.responseText
) {
40 ext_info
= ext_info
.responseText
;
45 "<div><b>Error message:</b></div>" +
46 "<pre>" + msg
+ "</pre>";
49 ebc
.innerHTML
+= "<div><b>Additional information:</b></div>" +
50 "<textarea readonly=\"1\">" + ext_info
+ "</textarea>";
53 ebc
.innerHTML
+= "<div><b>Stack trace:</b></div>" +
54 "<textarea readonly=\"1\">" + e
.stack
+ "</textarea>";
67 function format_exception_error(location
, e
) {
71 var base_fname
= e
.fileName
.substring(e
.fileName
.lastIndexOf("/") + 1);
73 msg
= "Exception: " + e
.name
+ ", " + e
.message
+
74 "\nFunction: " + location
+ "()" +
75 "\nLocation: " + base_fname
+ ":" + e
.lineNumber
;
77 } else if (e
.description
) {
78 msg
= "Exception: " + e
.description
+ "\nFunction: " + location
+ "()";
80 msg
= "Exception: " + e
+ "\nFunction: " + location
+ "()";
83 console
.error("EXCEPTION: " + msg
);
89 function disableHotkeys() {
90 hotkeys_enabled
= false;
93 function enableHotkeys() {
94 hotkeys_enabled
= true;
97 function param_escape(arg
) {
98 if (typeof encodeURIComponent
!= 'undefined')
99 return encodeURIComponent(arg
);
104 function param_unescape(arg
) {
105 if (typeof decodeURIComponent
!= 'undefined')
106 return decodeURIComponent(arg
);
108 return unescape(arg
);
111 function delay(gap
) {
113 then
=new Date().getTime();
115 while((now
-then
)<gap
) {
116 now
=new Date().getTime();
120 var notify_hide_timerid
= false;
122 function hide_notify() {
125 n
.style
.display
= "none";
129 function notify_silent_next() {
130 notify_silent
= true;
133 function notify_real(msg
, no_hide
, n_type
) {
136 notify_silent
= false;
141 var nb
= $("notify_body");
143 if (!n
|| !nb
) return;
145 if (notify_hide_timerid
) {
146 window
.clearTimeout(notify_hide_timerid
);
150 if (n
.style
.display
== "block") {
151 notify_hide_timerid
= window
.setTimeout("hide_notify()", 0);
155 n
.style
.display
= "block";
167 if (typeof __
!= 'undefined') {
172 n
.className
= "notify";
173 } else if (n_type
== 2) {
174 n
.className
= "notifyProgress";
175 msg
= "<img src='"+getInitParam("sign_progress")+"'> " + msg
;
176 } else if (n_type
== 3) {
177 n
.className
= "notifyError";
178 msg
= "<img src='"+getInitParam("sign_excl")+"'> " + msg
;
179 } else if (n_type
== 4) {
180 n
.className
= "notifyInfo";
181 msg
= "<img src='"+getInitParam("sign_info")+"'> " + msg
;
184 // msg = "<img src='images/live_com_loading.gif'> " + msg;
189 notify_hide_timerid
= window
.setTimeout("hide_notify()", 3000);
193 function notify(msg
, no_hide
) {
194 notify_real(msg
, no_hide
, 1);
197 function notify_progress(msg
, no_hide
) {
198 notify_real(msg
, no_hide
, 2);
201 function notify_error(msg
, no_hide
) {
202 notify_real(msg
, no_hide
, 3);
206 function notify_info(msg
, no_hide
) {
207 notify_real(msg
, no_hide
, 4);
210 function printLockingError() {
211 notify_info("Please wait until operation finishes.");
214 function cleanSelected(element
) {
215 var content
= $(element
);
217 for (i
= 0; i
< content
.rows
.length
; i
++) {
218 content
.rows
[i
].className
= content
.rows
[i
].className
.replace("Selected", "");
222 function getVisibleUnreadHeadlines() {
223 var content
= $("headlinesList");
225 var rows
= new Array();
227 if (!content
) return rows
;
229 for (i
= 0; i
< content
.rows
.length
; i
++) {
230 var row_id
= content
.rows
[i
].id
.replace("RROW-", "");
231 if (row_id
.length
> 0 && content
.rows
[i
].className
.match("Unread")) {
238 function getVisibleHeadlineIds() {
240 var content
= $("headlinesList");
242 var rows
= new Array();
244 if (!content
) return rows
;
246 for (i
= 0; i
< content
.rows
.length
; i
++) {
247 var row_id
= content
.rows
[i
].id
.replace("RROW-", "");
248 if (row_id
.length
> 0) {
255 function getFirstVisibleHeadlineId() {
257 var rows
= cdmGetVisibleArticles();
260 var rows
= getVisibleHeadlineIds();
265 function getLastVisibleHeadlineId() {
267 var rows
= cdmGetVisibleArticles();
268 return rows
[rows
.length
-1];
270 var rows
= getVisibleHeadlineIds();
271 return rows
[rows
.length
-1];
275 function markHeadline(id
) {
276 var row
= $("RROW-" + id
);
278 var is_active
= false;
280 if (row
.className
.match("Active")) {
283 row
.className
= row
.className
.replace("Selected", "");
284 row
.className
= row
.className
.replace("Active", "");
285 row
.className
= row
.className
.replace("Insensitive", "");
288 row
.className
= row
.className
= "Active";
291 var check
= $("RCHK-" + id
);
294 check
.checked
= true;
297 row
.className
= row
.className
+ "Selected";
302 function getFeedIds() {
303 var content
= $("feedsList");
305 var rows
= new Array();
307 for (i
= 0; i
< content
.rows
.length
; i
++) {
308 var id
= content
.rows
[i
].id
.replace("FEEDR-", "");
317 function setCookie(name
, value
, lifetime
, path
, domain
, secure
) {
323 d
.setTime(d
.getTime() + (lifetime
* 1000));
326 console
.log("setCookie: " + name
+ " => " + value
+ ": " + d
);
328 int_setCookie(name
, value
, d
, path
, domain
, secure
);
332 function int_setCookie(name
, value
, expires
, path
, domain
, secure
) {
333 document
.cookie
= name
+ "=" + escape(value
) +
334 ((expires
) ? "; expires=" + expires
.toGMTString() : "") +
335 ((path
) ? "; path=" + path
: "") +
336 ((domain
) ? "; domain=" + domain
: "") +
337 ((secure
) ? "; secure" : "");
340 function delCookie(name
, path
, domain
) {
341 if (getCookie(name
)) {
342 document
.cookie
= name
+ "=" +
343 ((path
) ? ";path=" + path
: "") +
344 ((domain
) ? ";domain=" + domain
: "" ) +
345 ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
350 function getCookie(name
) {
352 var dc
= document
.cookie
;
353 var prefix
= name
+ "=";
354 var begin
= dc
.indexOf("; " + prefix
);
356 begin
= dc
.indexOf(prefix
);
357 if (begin
!= 0) return null;
362 var end
= document
.cookie
.indexOf(";", begin
);
366 return unescape(dc
.substring(begin
+ prefix
.length
, end
));
369 function gotoPreferences() {
370 document
.location
.href
= "prefs.php";
373 function gotoMain() {
374 document
.location
.href
= "tt-rss.php";
377 function gotoExportOpml() {
378 document
.location
.href
= "opml.php?op=Export";
381 function parse_counters(reply
, scheduled_call
) {
386 var elems
= JSON
.parse(reply
.firstChild
.nodeValue
);
388 for (var l
= 0; l
< elems
.length
; l
++) {
391 var kind
= elems
[l
].kind
;
392 var ctr
= parseInt(elems
[l
].counter
)
393 var error
= elems
[l
].error
;
394 var has_img
= elems
[l
].has_img
;
395 var updated
= elems
[l
].updated
;
396 var title
= elems
[l
].title
;
397 var xmsg
= elems
[l
].xmsg
;
399 if (id
== "global-unread") {
401 if (ctr
> global_unread
) {
402 offlineDownloadStart(1);
410 if (id
== "subscribed-feeds") {
415 if (kind
&& kind
== "cat") {
416 var catctr
= $("FCATCTR-" + id
);
418 catctr
.innerHTML
= "(" + ctr
+ ")";
420 catctr
.className
= "catCtrHasUnread";
422 catctr
.className
= "catCtrNoUnread";
428 var feedctr
= $("FEEDCTR-" + id
);
429 var feedu
= $("FEEDU-" + id
);
430 var feedr
= $("FEEDR-" + id
);
431 var feed_img
= $("FIMG-" + id
);
432 var feedlink
= $("FEEDL-" + id
);
433 var feedupd
= $("FLUPD-" + id
);
435 if (updated
&& feedlink
) {
437 feedlink
.title
= "Error: " + error
+ " (" + updated
+ ")";
439 feedlink
.title
= "Updated: " + updated
;
444 if (!updated
) updated
= "";
448 feedupd
.innerHTML
= updated
+ " " + xmsg
+ " (Error)";
450 feedupd
.innerHTML
= updated
+ " (Error)";
454 feedupd
.innerHTML
= updated
+ " " + xmsg
;
456 feedupd
.innerHTML
= updated
;
461 if (has_img
&& feed_img
) {
462 if (!feed_img
.src
.match(id
+ ".ico")) {
463 feed_img
.src
= getInitParam("icons_url") + "/" + id
+ ".ico";
467 if (feedlink
&& title
) {
468 feedlink
.innerHTML
= title
;
471 if (feedctr
&& feedu
&& feedr
) {
473 if (parseInt(ctr
) > 0 &&
474 parseInt(feedu
.innerHTML
) < parseInt(ctr
) &&
475 id
== getActiveFeedId() && scheduled_call
) {
477 displayNewContentPrompt(id
);
480 var row_needs_hl
= (ctr
> 0 && ctr
> parseInt(feedu
.innerHTML
));
482 feedu
.innerHTML
= ctr
;
485 feedr
.className
= feedr
.className
.replace("feed", "error");
487 feedr
.className
= feedr
.className
.replace("error", "feed");
491 feedctr
.className
= "feedCtrHasUnread";
492 if (!feedr
.className
.match("Unread")) {
493 var is_selected
= feedr
.className
.match("Selected");
495 feedr
.className
= feedr
.className
.replace("Selected", "");
496 feedr
.className
= feedr
.className
.replace("Unread", "");
498 feedr
.className
= feedr
.className
+ "Unread";
501 feedr
.className
= feedr
.className
+ "Selected";
507 !getInitParam("theme_options").match('no_highlights')) {
508 new Effect
.Highlight(feedr
, {duration
: 1, startcolor
: "#fff7d5",
509 queue
: { position
:'end', scope
: 'EFQ-' + id
, limit
: 1 } } );
511 cache_invalidate("F:" + id
);
514 feedctr
.className
= "feedCtrNoUnread";
515 feedr
.className
= feedr
.className
.replace("Unread", "");
520 hideOrShowFeeds(getInitParam("hide_read_feeds") == 1);
522 var feeds_stored
= number_of_feeds
;
524 console
.log("Feed counters, C: " + feeds_found
+ ", S:" + feeds_stored
);
526 if (feeds_stored
!= feeds_found
) {
527 number_of_feeds
= feeds_found
;
529 if (feeds_stored
!= 0 && feeds_found
!= 0) {
530 console
.log("Subscribed feed number changed, refreshing feedlist");
531 setTimeout('updateFeedList(false, false)', 50);
534 /* var fl = $("feeds-frame").innerHTML;
536 cache_invalidate("FEEDLIST");
537 cache_inject("FEEDLIST", fl, getInitParam("num_feeds"));
542 exception_error("parse_counters", e
);
546 function parse_counters_reply(transport
, scheduled_call
) {
548 if (!transport
.responseXML
) {
549 notify_error("Backend did not return valid XML", true);
553 var reply
= transport
.responseXML
.firstChild
;
556 notify_error("Backend did not return expected XML object", true);
561 if (!transport_error_check(transport
)) return;
563 var counters
= reply
.getElementsByTagName("counters")[0];
566 parse_counters(counters
, scheduled_call
);
568 var runtime_info
= reply
.getElementsByTagName("runtime-info")[0];
571 parse_runtime_info(runtime_info
);
573 if (feedsSortByUnread()) {
577 hideOrShowFeeds(getInitParam("hide_read_feeds") == 1);
581 function all_counters_callback2(transport
, async_call
) {
583 if (async_call
) async_counters_work
= true;
585 if (offline_mode
) return;
587 console
.log("<b>all_counters_callback2 IN: " + transport
+ "</b>");
588 parse_counters_reply(transport
);
589 console
.log("<b>all_counters_callback2 OUT: " + transport
+ "</b>");
592 exception_error("all_counters_callback2", e
, transport
);
596 function get_feed_unread(id
) {
598 return parseInt($("FEEDU-" + id
).innerHTML
);
604 function get_cat_unread(id
) {
606 var ctr
= $("FCATCTR-" + id
).innerHTML
;
607 ctr
= ctr
.replace("(", "");
608 ctr
= ctr
.replace(")", "");
609 return parseInt(ctr
);
615 function get_feed_entry_unread(elem
) {
617 var id
= elem
.id
.replace("FEEDR-", "");
624 return parseInt($("FEEDU-" + id
).innerHTML
);
630 function get_feed_entry_name(elem
) {
631 var id
= elem
.id
.replace("FEEDR-", "");
632 return getFeedName(id
);
636 function resort_category(node
, cat_mode
) {
640 console
.log("resort_category: " + node
+ " CM=" + cat_mode
);
642 var by_unread
= feedsSortByUnread();
644 var list
= node
.getElementsByTagName("LI");
646 for (i
= 0; i
< list
.length
; i
++) {
648 for (j
= i
+1; j
< list
.length
; j
++) {
650 var tmp_val
= get_feed_entry_unread(list
[i
]);
651 var cur_val
= get_feed_entry_unread(list
[j
]);
653 var tmp_name
= get_feed_entry_name(list
[i
]);
654 var cur_name
= get_feed_entry_name(list
[j
]);
656 var valid_pair
= cat_mode
|| (list
[i
].id
.match(/FEEDR-[0-9]/) &&
657 list
[j
].id
.match(/FEEDR-[0-9]/));
659 if (valid_pair
&& ((by_unread
&& (cur_val
> tmp_val
)) || (!by_unread
&& (cur_name
< tmp_name
)))) {
660 tempnode_i
= list
[i
].cloneNode(true);
661 tempnode_j
= list
[j
].cloneNode(true);
662 node
.replaceChild(tempnode_i
, list
[j
]);
663 node
.replaceChild(tempnode_j
, list
[i
]);
669 exception_error("resort_category", e
);
674 function resort_feedlist() {
675 console
.log("resort_feedlist");
677 if ($("FCATLIST--1")) {
679 var lists
= document
.getElementsByTagName("UL");
681 for (var i
= 0; i
< lists
.length
; i
++) {
682 if (lists
[i
].id
&& lists
[i
].id
.match("FCATLIST-")) {
683 resort_category(lists
[i
], true);
688 resort_category($("feedList"), false);
692 /** * @(#)isNumeric.js * * Copyright (c) 2000 by Sundar Dorai-Raj
693 * * @author Sundar Dorai-Raj
694 * * Email: sdoraira@vt.edu
695 * * This program is free software; you can redistribute it and/or
696 * * modify it under the terms of the GNU General Public License
697 * * as published by the Free Software Foundation; either version 2
698 * * of the License, or (at your option) any later version,
699 * * provided that any use properly credits the author.
700 * * This program is distributed in the hope that it will be useful,
701 * * but WITHOUT ANY WARRANTY; without even the implied warranty of
702 * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
703 * * GNU General Public License for more details at http://www.gnu.org * * */
705 var numbers
=".0123456789";
706 function isNumeric(x
) {
707 // is x a String or a character?
709 // remove negative sign
711 for(j
=0;j
<x
.length
;j
++) {
712 // call isNumeric recursively for each character
713 number
=isNumeric(x
.substring(j
,j
+1));
714 if(!number
) return number
;
719 // if x is number return true
720 if(numbers
.indexOf(x
)>=0) return true;
726 function hideOrShowFeeds(hide
) {
730 console
.log("hideOrShowFeeds: " + hide
);
732 if ($("FCATLIST--1")) {
734 var lists
= document
.getElementsByTagName("UL");
736 for (var i
= 0; i
< lists
.length
; i
++) {
737 if (lists
[i
].id
&& lists
[i
].id
.match("FCATLIST-")) {
739 var id
= lists
[i
].id
.replace("FCATLIST-", "");
740 hideOrShowFeedsCategory(id
, hide
);
745 hideOrShowFeedsCategory(null, hide
);
749 exception_error("hideOrShowFeeds", e
);
753 function hideOrShowFeedsCategory(id
, hide
) {
761 node
= $("FCATLIST-" + id
);
762 cat_node
= $("FCAT-" + id
);
764 node
= $("feedList"); // no categories
767 // console.log("hideOrShowFeedsCategory: " + node + " (" + hide + ")");
772 console
.log("hideOrShowFeeds: passed node is null, aborting");
776 // console.log("cat: " + node.id);
778 if (node
.hasChildNodes() && node
.firstChild
.nextSibling
!= false) {
779 for (i
= 0; i
< node
.childNodes
.length
; i
++) {
780 if (node
.childNodes
[i
].nodeName
!= "LI") { continue; }
782 if (node
.childNodes
[i
].style
!= undefined) {
784 var has_unread
= (node
.childNodes
[i
].className
!= "feed" &&
785 node
.childNodes
[i
].className
!= "label" &&
786 !(!getInitParam("hide_read_shows_special") &&
787 node
.childNodes
[i
].className
== "virt") &&
788 node
.childNodes
[i
].className
!= "error" &&
789 node
.childNodes
[i
].className
!= "tag");
791 // console.log(node.childNodes[i].id + " --> " + has_unread);
793 if (hide
&& !has_unread
) {
794 //node.childNodes[i].style.display = "none";
795 var id
= node
.childNodes
[i
].id
;
796 Effect
.Fade(node
.childNodes
[i
], {duration
: 0.3,
797 queue
: { position
: 'end', scope
: 'FFADE-' + id
, limit
: 1 }});
801 node
.childNodes
[i
].style
.display
= "list-item";
802 //Effect.Appear(node.childNodes[i], {duration : 0.3});
806 node
.childNodes
[i
].style
.display
= "list-item";
808 //Effect.Appear(node.childNodes[i], {duration : 0.3});
809 //Effect.Highlight(node.childNodes[i]);
815 // console.log("end cat: " + node.id + " unread " + cat_unread);
819 if (cat_unread
== 0) {
820 if (cat_node
.style
== undefined) {
821 console
.log("ERROR: supplied cat_node " + cat_node
+
822 " has no styles. WTF?");
826 //cat_node.style.display = "none";
827 Effect
.Fade(cat_node
, {duration
: 0.3,
828 queue
: { position
: 'end', scope
: 'CFADE-' + node
.id
, limit
: 1 }});
830 cat_node
.style
.display
= "list-item";
834 cat_node
.style
.display
= "list-item";
841 // console.log("unread for category: " + cat_unread);
844 exception_error("hideOrShowFeedsCategory", e
);
848 function selectTableRow(r
, do_select
) {
849 r
.className
= r
.className
.replace("Selected", "");
852 r
.className
= r
.className
+ "Selected";
856 function selectTableRowById(elem_id
, check_id
, do_select
) {
860 var row
= $(elem_id
);
863 selectTableRow(row
, do_select
);
866 var check
= $(check_id
);
869 check
.checked
= do_select
;
872 exception_error("selectTableRowById", e
);
876 function selectTableRowsByIdPrefix(content_id
, prefix
, check_prefix
, do_select
,
877 classcheck
, reset_others
) {
879 var content
= $(content_id
);
882 console
.log("[selectTableRows] Element " + content_id
+ " not found.");
886 for (i
= 0; i
< content
.rows
.length
; i
++) {
887 if (Element
.visible(content
.rows
[i
])) {
888 if (!classcheck
|| content
.rows
[i
].className
.match(classcheck
)) {
890 if (content
.rows
[i
].id
.match(prefix
)) {
891 selectTableRow(content
.rows
[i
], do_select
);
893 var row_id
= content
.rows
[i
].id
.replace(prefix
, "");
894 var check
= $(check_prefix
+ row_id
);
897 check
.checked
= do_select
;
899 } else if (reset_others
) {
900 selectTableRow(content
.rows
[i
], false);
902 var row_id
= content
.rows
[i
].id
.replace(prefix
, "");
903 var check
= $(check_prefix
+ row_id
);
906 check
.checked
= false;
910 } else if (reset_others
) {
911 selectTableRow(content
.rows
[i
], false);
913 var row_id
= content
.rows
[i
].id
.replace(prefix
, "");
914 var check
= $(check_prefix
+ row_id
);
917 check
.checked
= false;
925 function getSelectedTableRowIds(content_id
, prefix
) {
927 var content
= $(content_id
);
930 console
.log("[getSelectedTableRowIds] Element " + content_id
+ " not found.");
934 var sel_rows
= new Array();
936 for (i
= 0; i
< content
.rows
.length
; i
++) {
937 if (content
.rows
[i
].id
.match(prefix
) &&
938 content
.rows
[i
].className
.match("Selected")) {
940 var row_id
= content
.rows
[i
].id
.replace(prefix
+ "-", "");
941 sel_rows
.push(row_id
);
949 function toggleSelectRowById(sender
, id
) {
952 if (sender
.checked
) {
953 if (!row
.className
.match("Selected")) {
954 row
.className
= row
.className
+ "Selected";
957 if (row
.className
.match("Selected")) {
958 row
.className
= row
.className
.replace("Selected", "");
963 function toggleSelectListRow(sender
) {
964 var parent_row
= sender
.parentNode
;
966 if (sender
.checked
) {
967 if (!parent_row
.className
.match("Selected")) {
968 parent_row
.className
= parent_row
.className
+ "Selected";
971 if (parent_row
.className
.match("Selected")) {
972 parent_row
.className
= parent_row
.className
.replace("Selected", "");
977 function tSR(sender
) {
978 return toggleSelectRow(sender
);
981 function toggleSelectRow(sender
) {
982 var parent_row
= sender
.parentNode
.parentNode
;
984 if (sender
.checked
) {
985 if (!parent_row
.className
.match("Selected")) {
986 parent_row
.className
= parent_row
.className
+ "Selected";
989 if (parent_row
.className
.match("Selected")) {
990 parent_row
.className
= parent_row
.className
.replace("Selected", "");
995 function getNextUnreadCat(id
) {
997 var rows
= $("feedList").getElementsByTagName("LI");
998 var feeds
= new Array();
1000 var unread_only
= true;
1003 for (var i
= 0; i
< rows
.length
; i
++) {
1004 if (rows
[i
].id
.match("FCAT-")) {
1005 if (rows
[i
].id
== "FCAT-" + id
&& is_cat
|| (Element
.visible(rows
[i
]) && Element
.visible(rows
[i
].parentNode
))) {
1007 var cat_id
= parseInt(rows
[i
].id
.replace("FCAT-", ""));
1010 if (!unread_only
|| get_cat_unread(cat_id
) > 0) {
1018 var idx
= feeds
.indexOf(id
);
1019 if (idx
!= -1 && idx
< feeds
.length
) {
1020 return feeds
[idx
+1];
1022 return feeds
.shift();
1026 exception_error("getNextUnreadCat", e
);
1030 function getRelativeFeedId2(id
, is_cat
, direction
, unread_only
) {
1033 // alert(id + " IC: " + is_cat + " D: " + direction + " U: " + unread_only);
1035 var rows
= $("feedList").getElementsByTagName("LI");
1036 var feeds
= new Array();
1038 for (var i
= 0; i
< rows
.length
; i
++) {
1039 if (rows
[i
].id
.match("FEEDR-")) {
1041 if (rows
[i
].id
== "FEEDR-" + id
&& !is_cat
|| (Element
.visible(rows
[i
]) && Element
.visible(rows
[i
].parentNode
))) {
1044 (rows
[i
].className
.match("Unread") || rows
[i
].id
== "FEEDR-" + id
)) {
1045 feeds
.push(rows
[i
].id
.replace("FEEDR-", ""));
1050 if (rows
[i
].id
.match("FCAT-")) {
1051 if (rows
[i
].id
== "FCAT-" + id
&& is_cat
|| (Element
.visible(rows
[i
]) && Element
.visible(rows
[i
].parentNode
))) {
1053 var cat_id
= parseInt(rows
[i
].id
.replace("FCAT-", ""));
1056 if (!unread_only
|| get_cat_unread(cat_id
) > 0) {
1057 feeds
.push("CAT:"+cat_id
);
1064 // alert(feeds.toString());
1067 if (direction
== "next") {
1068 return feeds
.shift();
1073 if (direction
== "next") {
1074 if (is_cat
) id
= "CAT:" + id
;
1075 var idx
= feeds
.indexOf(id
);
1076 if (idx
!= -1 && idx
< feeds
.length
) {
1077 return feeds
[idx
+1];
1079 return getRelativeFeedId2(false, is_cat
, direction
, unread_only
);
1082 if (is_cat
) id
= "CAT:" + id
;
1083 var idx
= feeds
.indexOf(id
);
1085 return feeds
[idx
-1];
1087 return getRelativeFeedId2(false, is_cat
, direction
, unread_only
);
1094 exception_error("getRelativeFeedId2", e
);
1098 function checkboxToggleElement(elem
, id
) {
1100 Effect
.Appear(id
, {duration
: 0.5});
1102 Effect
.Fade(id
, {duration
: 0.5});
1106 function dropboxSelect(e
, v
) {
1107 for (i
= 0; i
< e
.length
; i
++) {
1108 if (e
[i
].value
== v
) {
1109 e
.selectedIndex
= i
;
1115 // originally stolen from http://www.11tmr.com/11tmr.nsf/d6plinks/MWHE-695L9Z
1116 // bugfixed just a little bit :-)
1117 function getURLParam(strParamName
){
1119 var strHref
= window
.location
.href
;
1121 if (strHref
.indexOf("#") == strHref
.length
-1) {
1122 strHref
= strHref
.substring(0, strHref
.length
-1);
1125 if ( strHref
.indexOf("?") > -1 ){
1126 var strQueryString
= strHref
.substr(strHref
.indexOf("?"));
1127 var aQueryString
= strQueryString
.split("&");
1128 for ( var iParam
= 0; iParam
< aQueryString
.length
; iParam
++ ){
1129 if (aQueryString
[iParam
].indexOf(strParamName
+ "=") > -1 ){
1130 var aParam
= aQueryString
[iParam
].split("=");
1131 strReturn
= aParam
[1];
1139 function leading_zero(p
) {
1141 if (s
.length
== 1) s
= "0" + s
;
1145 function make_timestamp() {
1148 return leading_zero(d
.getHours()) + ":" + leading_zero(d
.getMinutes()) +
1149 ":" + leading_zero(d
.getSeconds());
1153 function closeErrorBox() {
1155 if (Element
.visible("errorBoxShadow")) {
1156 Element
.hide("dialog_overlay");
1157 Element
.hide("errorBoxShadow");
1165 function closeInfoBox(cleanup
) {
1170 if (Element
.visible("infoBoxShadow")) {
1171 Element
.hide("dialog_overlay");
1172 Element
.hide("infoBoxShadow");
1174 if (cleanup
) $("infoBox").innerHTML
= " ";
1177 exception_error("closeInfoBox", e
);
1184 function displayDlg(id
, param
, callback
) {
1186 notify_progress("Loading, please wait...", true);
1190 var query
= "?op=dlg&id=" +
1191 param_escape(id
) + "¶m=" + param_escape(param
);
1193 new Ajax
.Request("backend.php", {
1195 onComplete: function (transport
) {
1196 infobox_callback2(transport
);
1197 if (callback
) callback(transport
);
1203 function infobox_submit_callback2(transport
) {
1207 // called from prefs, reload tab
1208 if (typeof active_tab
!= 'undefined' && active_tab
) {
1209 selectTab(active_tab
, false);
1213 if (transport
.responseText
) {
1214 notify_info(transport
.responseText
);
1218 function infobox_callback2(transport
) {
1221 console
.log("infobox_callback2");
1223 var box
= $('infoBox');
1227 if (!getInitParam("infobox_disable_overlay")) {
1228 Element
.show("dialog_overlay");
1231 box
.innerHTML
=transport
.responseText
;
1232 Element
.show("infoBoxShadow");
1233 //Effect.SlideDown("infoBoxShadow", {duration : 1.0});
1242 exception_error("infobox_callback2", e
);
1246 function createFilter() {
1250 var form
= document
.forms
['filter_add_form'];
1251 var reg_exp
= form
.reg_exp
.value
;
1253 if (reg_exp
== "") {
1254 alert(__("Can't add filter: nothing to match on."));
1258 var query
= Form
.serialize("filter_add_form");
1260 // we can be called from some other tab in Prefs
1261 if (typeof active_tab
!= 'undefined' && active_tab
) {
1262 active_tab
= "filterConfig";
1265 new Ajax
.Request("backend.php?" + query
, {
1266 onComplete: function (transport
) {
1267 infobox_submit_callback2(transport
);
1273 exception_error("createFilter", e
);
1277 function isValidURL(s
) {
1278 return s
.match("http://") != null || s
.match("https://") != null || s
.match("feed://") != null;
1281 function subscribeToFeed() {
1285 var form
= document
.forms
['feed_add_form'];
1286 var feed_url
= form
.feed_url
.value
;
1288 if (feed_url
== "") {
1289 alert(__("Can't subscribe: no feed URL given."));
1293 notify_progress(__("Subscribing to feed..."), true);
1295 var query
= Form
.serialize("feed_add_form");
1297 console
.log("subscribe q: " + query
);
1299 Form
.disable("feed_add_form");
1301 new Ajax
.Request("backend.php", {
1303 onComplete: function(transport
) {
1304 //dlg_frefresh_callback(transport);
1308 var result
= transport
.responseXML
.getElementsByTagName('result')[0];
1309 var rc
= parseInt(result
.getAttribute('code'));
1311 Form
.enable("feed_add_form");
1316 notify_info(__("Subscribed to %s").replace("%s", feed_url
));
1318 if (inPreferences()) {
1321 setTimeout('updateFeedList(false, false)', 50);
1325 alert(__("Can't subscribe to the specified URL."));
1328 alert(__("You are already subscribed to this feed."));
1335 exception_error("subscribeToFeed", e
);
1341 function filterCR(e
, f
)
1346 key
= window
.event
.keyCode
; //IE
1348 key
= e
.which
; //firefox
1351 if (typeof f
!= 'undefined') {
1362 var debug_last_class
= "even";
1364 function debug(msg
) {
1366 if (debug_last_class
== "even") {
1367 debug_last_class
= "odd";
1369 debug_last_class
= "even";
1372 var c
= $('debug_output');
1373 if (c
&& Element
.visible(c
)) {
1374 while (c
.lastChild
!= 'undefined' && c
.childNodes
.length
> 100) {
1375 c
.removeChild(c
.lastChild
);
1378 var ts
= make_timestamp();
1379 c
.innerHTML
= "<li class=\"" + debug_last_class
+ "\"><span class=\"debugTS\">[" + ts
+ "]</span> " +
1380 msg
+ "</li>" + c
.innerHTML
;
1384 function getInitParam(key
) {
1385 return init_params
[key
];
1388 function setInitParam(key
, value
) {
1389 init_params
[key
] = value
;
1392 function fatalError(code
, msg
, ext_info
) {
1395 if (!ext_info
) ext_info
= "N/A";
1398 window
.location
.href
= "tt-rss.php";
1399 } else if (code
== 5) {
1400 window
.location
.href
= "update.php";
1403 if (msg
== "") msg
= "Unknown error";
1405 var ebc
= $("xebContent");
1409 Element
.show("dialog_overlay");
1410 Element
.show("errorBoxShadow");
1411 Element
.hide("xebBtn");
1414 if (ext_info
.responseText
) {
1415 ext_info
= ext_info
.responseText
;
1420 "<div><b>Error message:</b></div>" +
1421 "<pre>" + msg
+ "</pre>" +
1422 "<div><b>Additional information:</b></div>" +
1423 "<textarea readonly=\"1\">" + ext_info
+ "</textarea>";
1428 exception_error("fatalError", e
);
1432 function getFeedName(id
, is_cat
) {
1436 e
= $("FCATN-" + id
);
1438 e
= $("FEEDN-" + id
);
1441 return e
.innerHTML
.stripTags();
1447 function filterDlgCheckType(sender
) {
1451 var ftype
= sender
[sender
.selectedIndex
].value
;
1453 var form
= document
.forms
["filter_add_form"];
1456 form
= document
.forms
["filter_edit_form"];
1460 console
.log("filterDlgCheckType: can't find form!");
1464 // if selected filter type is 5 (Date) enable the modifier dropbox
1466 Element
.show("filter_dlg_date_mod_box");
1467 Element
.show("filter_dlg_date_chk_box");
1469 Element
.hide("filter_dlg_date_mod_box");
1470 Element
.hide("filter_dlg_date_chk_box");
1475 exception_error("filterDlgCheckType", e
);
1480 function filterDlgCheckAction(sender
) {
1484 var action
= sender
[sender
.selectedIndex
].value
;
1486 var form
= document
.forms
["filter_add_form"];
1489 form
= document
.forms
["filter_edit_form"];
1493 console
.log("filterDlgCheckAction: can't find form!");
1497 var action_param
= $("filter_dlg_param_box");
1499 if (!action_param
) {
1500 console
.log("filterDlgCheckAction: can't find action param box!");
1504 // if selected action supports parameters, enable params field
1505 if (action
== 4 || action
== 6 || action
== 7) {
1506 Element
.show(action_param
);
1508 Element
.show(form
.action_param
);
1509 Element
.hide(form
.action_param_label
);
1511 Element
.show(form
.action_param_label
);
1512 Element
.hide(form
.action_param
);
1515 Element
.hide(action_param
);
1519 exception_error("filterDlgCheckAction", e
);
1524 function filterDlgCheckDate() {
1526 var form
= document
.forms
["filter_add_form"];
1529 form
= document
.forms
["filter_edit_form"];
1533 console
.log("filterDlgCheckAction: can't find form!");
1537 var reg_exp
= form
.reg_exp
.value
;
1539 var query
= "?op=rpc&subop=checkDate&date=" + reg_exp
;
1541 new Ajax
.Request("backend.php", {
1543 onComplete: function(transport
) {
1545 var form
= document
.forms
["filter_add_form"];
1548 form
= document
.forms
["filter_edit_form"];
1551 if (transport
.responseXML
) {
1552 var result
= transport
.responseXML
.getElementsByTagName("result")[0];
1554 if (result
&& result
.firstChild
) {
1555 if (result
.firstChild
.nodeValue
== "1") {
1557 new Effect
.Highlight(form
.reg_exp
, {startcolor
: '#00ff00'});
1564 new Effect
.Highlight(form
.reg_exp
, {startcolor
: '#ff0000'});
1570 exception_error("filterDlgCheckDate", e
);
1574 function explainError(code
) {
1575 return displayDlg("explainError", code
);
1578 // this only searches loaded headlines list, not in CDM
1579 function getRelativePostIds(id
, limit
) {
1581 if (!limit
) limit
= 3;
1583 console
.log("getRelativePostIds: " + id
+ " limit=" + limit
);
1585 var ids
= new Array();
1586 var container
= $("headlinesList");
1589 var rows
= container
.rows
;
1591 for (var i
= 0; i
< rows
.length
; i
++) {
1592 var r_id
= rows
[i
].id
.replace("RROW-", "");
1595 for (var k
= 1; k
<= limit
; k
++) {
1598 if (i
> k
-1) var nid
= rows
[i
-k
].id
.replace("RROW-", "");
1599 if (nid
) ids
.push(nid
);
1601 if (i
< rows
.length
-k
) nid
= rows
[i
+k
].id
.replace("RROW-", "");
1602 if (nid
) ids
.push(nid
);
1613 function openArticleInNewWindow(id
) {
1615 console
.log("openArticleInNewWindow: " + id
);
1617 var query
= "?op=rpc&subop=getArticleLink&id=" + id
;
1618 var wname
= "ttrss_article_" + id
;
1620 console
.log(query
+ " " + wname
);
1622 var w
= window
.open("", wname
);
1624 if (!w
) notify_error("Failed to open window for the article");
1626 new Ajax
.Request("backend.php", {
1628 onComplete: function(transport
) {
1630 var link
= transport
.responseXML
.getElementsByTagName("link")[0];
1631 var id
= transport
.responseXML
.getElementsByTagName("id")[0];
1633 console
.log("open_article received link: " + link
);
1637 var wname
= "ttrss_article_" + id
.firstChild
.nodeValue
;
1639 console
.log("link url: " + link
.firstChild
.nodeValue
+ ", wname " + wname
);
1641 var w
= window
.open(link
.firstChild
.nodeValue
, wname
);
1643 if (!w
) { notify_error("Failed to load article in new window"); }
1646 id
= id
.firstChild
.nodeValue
;
1647 if (!$("headlinesList")) {
1648 window
.setTimeout("toggleUnread(" + id
+ ", 0)", 100);
1652 notify_error("Can't open article: received invalid article link");
1657 exception_error("openArticleInNewWindow", e
);
1661 /* http://textsnippets.com/posts/show/835 */
1663 Position
.GetWindowSize = function(w
) {
1665 var width
= w
.innerWidth
|| (w
.document
.documentElement
.clientWidth
|| w
.document
.body
.clientWidth
);
1666 var height
= w
.innerHeight
|| (w
.document
.documentElement
.clientHeight
|| w
.document
.body
.clientHeight
);
1667 return [width
, height
]
1670 /* http://textsnippets.com/posts/show/836 */
1672 Position
.Center = function(element
, parent
) {
1674 var d
= Element
.getDimensions(element
);
1679 var ws
= Position
.GetWindowSize();
1683 pw
= parent
.offsetWidth
;
1684 ph
= parent
.offsetHeight
;
1686 element
.style
.top
= (ph
/2) - (h/2) - Position
.deltaY
+ "px";
1687 element
.style
.left
= (pw
/2) - (w/2) - Position
.deltaX
+ "px";
1691 function isCdmMode() {
1692 return !$("headlinesList");
1695 function getSelectedArticleIds2() {
1696 var rows
= new Array();
1697 var cdm_mode
= isCdmMode();
1700 rows
= cdmGetSelectedArticles();
1702 rows
= getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
1705 var ids
= new Array();
1707 for (var i
= 0; i
< rows
.length
; i
++) {
1708 var chk
= $("RCHK-" + rows
[i
]);
1709 if (chk
&& chk
.checked
) {
1717 function displayHelpInfobox(topic_id
) {
1719 var url
= "backend.php?op=help&tid=" + param_escape(topic_id
);
1721 var w
= window
.open(url
, "ttrss_help",
1722 "status=0,toolbar=0,location=0,width=450,height=500,scrollbars=1,menubar=0");
1726 function focus_element(id
) {
1731 exception_error("focus_element", e
);
1736 function loading_set_progress(p
) {
1738 if (p
< last_progress_point
|| !Element
.visible("overlay")) return;
1740 console
.log("<b>loading_set_progress : " + p
+ " (" + last_progress_point
+ ")</b>");
1742 var o
= $("l_progress_i");
1744 // o.style.width = (p * 2) + "px";
1746 new Effect
.Scale(o
, p
, {
1748 scaleFrom
: last_progress_point
,
1749 scaleMode
: { originalWidth
: 200 },
1750 queue
: { position
: 'end', scope
: 'LSP-Q', limit
: 3 } });
1752 last_progress_point
= p
;
1755 exception_error("loading_set_progress", e
);
1759 function remove_splash() {
1760 if (Element
.visible("overlay")) {
1761 console
.log("about to remove splash, OMG!");
1762 Element
.hide("overlay");
1763 console
.log("removed splash!");
1767 function getSelectedFeedsFromBrowser() {
1769 var list
= $("browseFeedList");
1771 var selected
= new Array();
1773 for (i
= 0; i
< list
.childNodes
.length
; i
++) {
1774 var child
= list
.childNodes
[i
];
1775 if (child
.id
&& child
.id
.match("FBROW-")) {
1776 var id
= child
.id
.replace("FBROW-", "");
1778 var cb
= $("FBCHK-" + id
);
1789 function updateFeedBrowser() {
1792 var query
= Form
.serialize("feed_browser");
1794 Element
.show('feed_browser_spinner');
1796 new Ajax
.Request("backend.php", {
1798 onComplete: function(transport
) {
1801 Element
.hide('feed_browser_spinner');
1803 var c
= $("browseFeedList");
1804 var r
= transport
.responseXML
.getElementsByTagName("content")[0];
1805 var nr
= transport
.responseXML
.getElementsByTagName("num-results")[0];
1806 var mode
= transport
.responseXML
.getElementsByTagName("mode")[0];
1809 c
.innerHTML
= r
.firstChild
.nodeValue
;
1812 if (parseInt(mode
.getAttribute("value")) == 2) {
1813 Element
.show('feed_archive_remove');
1815 Element
.hide('feed_archive_remove');
1821 exception_error("updateFeedBrowser", e
);
1826 function transport_error_check(transport
) {
1828 if (transport
.responseXML
) {
1829 var error
= transport
.responseXML
.getElementsByTagName("error")[0];
1832 var code
= error
.getAttribute("error-code");
1833 var msg
= error
.getAttribute("error-msg");
1835 fatalError(code
, msg
);
1841 exception_error("check_for_error_xml", e
);
1846 function strip_tags(s
) {
1847 return s
.replace(/<\/?[^>]+(>|$)/g, "");
1850 function truncate_string(s
, length
) {
1851 if (!length
) length
= 30;
1852 var tmp
= s
.substring(0, length
);
1853 if (s
.length
> length
) tmp
+= "…";
1857 function hotkey_prefix_timeout() {
1860 var date
= new Date();
1861 var ts
= Math
.round(date
.getTime() / 1000);
1863 if (hotkey_prefix_pressed
&& ts
- hotkey_prefix_pressed
>= 5) {
1864 console
.log("hotkey_prefix seems to be stuck, aborting");
1865 hotkey_prefix_pressed
= false;
1866 hotkey_prefix
= false;
1867 Element
.hide('cmdline');
1870 setTimeout("hotkey_prefix_timeout()", 1000);
1873 exception_error("hotkey_prefix_timeout", e
);
1877 function hideAuxDlg() {
1879 Element
.hide('auxDlg');
1881 exception_error("hideAuxDlg", e
);
1885 function displayNewContentPrompt(id
) {
1888 var msg
= "<a href='#' onclick='viewfeed("+id
+")'>" +
1889 __("New articles available in this feed (click to show)") + "</a>";
1891 msg
= msg
.replace("%s", getFeedName(id
));
1893 $('auxDlg').innerHTML
= msg
;
1895 Element
.show('auxDlg');
1898 exception_error("displayNewContentPrompt", e
);
1902 function feedBrowserSubscribe() {
1905 var selected
= getSelectedFeedsFromBrowser();
1907 var mode
= document
.forms
['feed_browser'].mode
;
1909 mode
= mode
[mode
.selectedIndex
].value
;
1911 if (selected
.length
> 0) {
1914 notify_progress("Loading, please wait...", true);
1916 var query
= "?op=rpc&subop=massSubscribe&ids="+
1917 param_escape(selected
.toString()) + "&mode=" + param_escape(mode
);
1919 new Ajax
.Request("backend.php", {
1921 onComplete: function(transport
) {
1923 var nf
= transport
.responseXML
.getElementsByTagName('num-feeds')[0];
1924 var nf_value
= nf
.getAttribute("value");
1926 notify_info(__("Subscribed to %d feed(s).").replace("%d", nf_value
));
1928 if (inPreferences()) {
1931 setTimeout('updateFeedList(false, false)', 50);
1936 alert(__("No feeds are selected."));
1940 exception_error("feedBrowserSubscribe", e
);
1944 function feedArchiveRemove() {
1947 var selected
= getSelectedFeedsFromBrowser();
1949 if (selected
.length
> 0) {
1951 var pr
= __("Remove selected feeds from the archive? Feeds with stored articles will not be removed.");
1954 Element
.show('feed_browser_spinner');
1956 var query
= "?op=rpc&subop=remarchived&ids=" +
1957 param_escape(selected
.toString());;
1959 new Ajax
.Request("backend.php", {
1961 onComplete: function(transport
) {
1962 updateFeedBrowser();
1967 alert(__("No feeds are selected."));
1971 exception_error("feedArchiveRemove", e
);
1975 function uploadIconHandler(rc
) {
1979 notify_info("Upload complete.");
1980 if (inPreferences()) {
1983 setTimeout('updateFeedList(false, false)', 50);
1987 notify_error("Upload failed: icon is too big.");
1990 notify_error("Upload failed.");
1995 exception_error("uploadIconHandler", e
);
1999 function removeFeedIcon(id
) {
2003 if (confirm(__("Remove stored feed icon?"))) {
2004 var query
= "backend.php?op=pref-feeds&subop=removeicon&feed_id=" + param_escape(id
);
2008 notify_progress("Removing feed icon...", true);
2010 new Ajax
.Request("backend.php", {
2012 onComplete: function(transport
) {
2013 notify_info("Feed icon removed.");
2014 if (inPreferences()) {
2017 setTimeout('updateFeedList(false, false)', 50);
2024 exception_error("uploadFeedIcon", e
);
2028 function uploadFeedIcon() {
2032 var file
= $("icon_file");
2034 if (file
.value
.length
== 0) {
2035 alert(__("Please select an image file to upload."));
2037 if (confirm(__("Upload new icon for this feed?"))) {
2038 notify_progress("Uploading, please wait...", true);
2046 exception_error("uploadFeedIcon", e
);
2050 function addLabel() {
2054 var caption
= prompt(__("Please enter label caption:"), "");
2056 if (caption
!= undefined) {
2058 if (caption
== "") {
2059 alert(__("Can't create label: missing caption."));
2063 var query
= "?op=pref-labels&subop=add&caption=" +
2064 param_escape(caption
);
2066 notify_progress("Loading, please wait...", true);
2068 if (inPreferences()) active_tab
= "labelConfig";
2070 new Ajax
.Request("backend.php", {
2072 onComplete: function(transport
) {
2073 if (inPreferences()) {
2074 infobox_submit_callback2(transport
);
2083 exception_error("addLabel", e
);
2087 function quickAddFeed() {
2088 displayDlg('quickAddFeed', '',
2089 function () {$('feed_url').focus();});
2092 function quickAddFilter() {
2093 displayDlg('quickAddFilter', '',
2094 function () {document
.forms
['filter_add_form'].reg_exp
.focus();});
2097 function unsubscribeFeed(feed_id
, title
) {
2099 var msg
= __("Unsubscribe from %s?").replace("%s", title
);
2101 if (title
== undefined || confirm(msg
)) {
2102 notify_progress("Removing feed...");
2104 var query
= "?op=pref-feeds&quiet=1&subop=remove&ids=" + feed_id
;
2106 new Ajax
.Request("backend.php", {
2108 onComplete: function(transport
) {
2112 if (inPreferences()) {
2115 dlg_frefresh_callback(transport
, feed_id
);
2125 function backend_sanity_check_callback(transport
) {
2129 if (sanity_check_done
) {
2130 fatalError(11, "Sanity check request received twice. This can indicate "+
2131 "presence of Firebug or some other disrupting extension. "+
2132 "Please disable it and try again.");
2136 if (!transport
.responseXML
) {
2138 fatalError(3, "Sanity check: Received reply is not XML",
2139 transport
.responseText
);
2147 if (getURLParam("offline")) {
2148 return init_offline();
2151 var reply
= transport
.responseXML
.getElementsByTagName("error")[0];
2154 fatalError(3, "Sanity check: invalid RPC reply", transport
.responseText
);
2158 var error_code
= reply
.getAttribute("error-code");
2160 if (error_code
&& error_code
!= 0) {
2161 return fatalError(error_code
, reply
.getAttribute("error-msg"));
2164 console
.log("sanity check ok");
2166 var params
= transport
.responseXML
.getElementsByTagName("init-params")[0];
2169 console
.log('reading init-params...');
2170 //var param = params.firstChild;
2172 params
= JSON
.parse(params
.firstChild
.nodeValue
);
2175 for (var i
= 0; i
< params
.length
; i
++) {
2177 var k
= params
[i
].param
;
2178 var v
= params
[i
].value
;
2180 console
.log(k
+ " => " + v
);
2184 db
.execute("DELETE FROM init_params WHERE key = ?", [k
]);
2185 db
.execute("INSERT INTO init_params (key,value) VALUES (?, ?)",
2192 sanity_check_done
= true;
2194 init_second_stage();
2197 exception_error("backend_sanity_check_callback", e
, transport
);