]>
Commit | Line | Data |
---|---|---|
1 | var hotkeys_enabled = true; | |
2 | ||
3 | var xmlhttp_rpc = Ajax.getTransport(); | |
4 | ||
5 | function browser_has_opacity() { | |
6 | return navigator.userAgent.match("Gecko") != null || | |
7 | navigator.userAgent.match("Opera") != null; | |
8 | } | |
9 | ||
10 | function is_opera() { | |
11 | return navigator.userAgent.match("Opera"); | |
12 | } | |
13 | ||
14 | function exception_error(location, e, silent) { | |
15 | var msg; | |
16 | ||
17 | if (e.fileName) { | |
18 | var base_fname = e.fileName.substring(e.fileName.lastIndexOf("/") + 1); | |
19 | ||
20 | msg = "Exception: " + e.name + ", " + e.message + | |
21 | "\nFunction: " + location + "()" + | |
22 | "\nLocation: " + base_fname + ":" + e.lineNumber; | |
23 | ||
24 | } else { | |
25 | msg = "Exception: " + e + "\nFunction: " + location + "()"; | |
26 | } | |
27 | ||
28 | debug("<b>EXCEPTION: " + msg + "</b>"); | |
29 | ||
30 | if (!silent) { | |
31 | alert(msg); | |
32 | } | |
33 | } | |
34 | ||
35 | function disableHotkeys() { | |
36 | hotkeys_enabled = false; | |
37 | } | |
38 | ||
39 | function enableHotkeys() { | |
40 | hotkeys_enabled = true; | |
41 | } | |
42 | ||
43 | function xmlhttp_ready(obj) { | |
44 | return obj.readyState == 4 || obj.readyState == 0 || !obj.readyState; | |
45 | } | |
46 | ||
47 | function notify_callback() { | |
48 | var container = document.getElementById('notify'); | |
49 | if (xmlhttp.readyState == 4) { | |
50 | container.innerHTML=xmlhttp.responseText; | |
51 | } | |
52 | } | |
53 | ||
54 | function rpc_notify_callback() { | |
55 | var container = document.getElementById('notify'); | |
56 | if (xmlhttp_rpc.readyState == 4) { | |
57 | container.innerHTML=xmlhttp_rpc.responseText; | |
58 | } | |
59 | } | |
60 | ||
61 | function param_escape(arg) { | |
62 | if (typeof encodeURIComponent != 'undefined') | |
63 | return encodeURIComponent(arg); | |
64 | else | |
65 | return escape(arg); | |
66 | } | |
67 | ||
68 | function param_unescape(arg) { | |
69 | if (typeof decodeURIComponent != 'undefined') | |
70 | return decodeURIComponent(arg); | |
71 | else | |
72 | return unescape(arg); | |
73 | } | |
74 | ||
75 | function delay(gap) { | |
76 | var then,now; | |
77 | then=new Date().getTime(); | |
78 | now=then; | |
79 | while((now-then)<gap) { | |
80 | now=new Date().getTime(); | |
81 | } | |
82 | } | |
83 | ||
84 | var notify_hide_timerid = false; | |
85 | var notify_last_doc = false; | |
86 | ||
87 | var notify_effect = false; | |
88 | ||
89 | function hide_notify() { | |
90 | if (notify_last_doc) { | |
91 | var n = notify_last_doc.getElementById("notify"); | |
92 | if (browser_has_opacity()) { | |
93 | if (notify_opacity >= 0) { | |
94 | notify_opacity = notify_opacity - 0.1; | |
95 | n.style.opacity = notify_opacity; | |
96 | notify_hide_timerid = window.setTimeout("hide_notify()", 20); | |
97 | } else { | |
98 | n.style.display = "none"; | |
99 | n.style.opacity = 1; | |
100 | } | |
101 | } else { | |
102 | n.style.display = "none"; | |
103 | } | |
104 | } | |
105 | } | |
106 | ||
107 | function notify_real(msg, doc, no_hide, is_err) { | |
108 | ||
109 | var n = doc.getElementById("notify"); | |
110 | var nb = doc.getElementById("notify_body"); | |
111 | ||
112 | if (!n || !nb) return; | |
113 | ||
114 | if (notify_hide_timerid) { | |
115 | window.clearTimeout(notify_hide_timerid); | |
116 | } | |
117 | ||
118 | notify_last_doc = doc; | |
119 | notify_opacity = 1; | |
120 | ||
121 | if (msg == "") { | |
122 | if (n.style.display == "block") { | |
123 | notify_hide_timerid = window.setTimeout("hide_notify()", 0); | |
124 | } | |
125 | return; | |
126 | } else { | |
127 | n.style.display = "block"; | |
128 | } | |
129 | ||
130 | if (is_err) { | |
131 | n.style.backgroundColor = "#ffcccc"; | |
132 | n.style.color = "black"; | |
133 | n.style.borderColor = "#ff0000"; | |
134 | } else { | |
135 | n.style.backgroundColor = "#fff7d5"; | |
136 | n.style.borderColor = "#d7c47a"; | |
137 | n.style.color = "black"; | |
138 | } | |
139 | ||
140 | nb.innerHTML = msg; | |
141 | ||
142 | if (!no_hide) { | |
143 | notify_hide_timerid = window.setTimeout("hide_notify()", 3000); | |
144 | } | |
145 | } | |
146 | ||
147 | function p_notify(msg, no_hide, is_err) { | |
148 | notify_real(msg, parent.document, no_hide, is_err); | |
149 | } | |
150 | ||
151 | function notify(msg, no_hide, is_err) { | |
152 | notify_real(msg, document, no_hide, is_err); | |
153 | } | |
154 | ||
155 | function printLockingError() { | |
156 | notify("Please wait until operation finishes");} | |
157 | ||
158 | function hotkey_handler(e) { | |
159 | ||
160 | try { | |
161 | ||
162 | var keycode; | |
163 | ||
164 | if (!hotkeys_enabled) return; | |
165 | ||
166 | return; //fixme disables for now | |
167 | ||
168 | if (window.event) { | |
169 | keycode = window.event.keyCode; | |
170 | } else if (e) { | |
171 | keycode = e.which; | |
172 | } | |
173 | ||
174 | var m_ctx = getMainContext(); | |
175 | var f_ctx = getFeedsContext(); | |
176 | var h_ctx = getHeadlinesContext(); | |
177 | ||
178 | if (keycode == 82) { // r | |
179 | return m_ctx.scheduleFeedUpdate(true); | |
180 | } | |
181 | ||
182 | if (keycode == 83) { // r | |
183 | return m_ctx.displayDlg("search", getActiveFeedId()); | |
184 | } | |
185 | ||
186 | if (keycode == 85) { // u | |
187 | if (getActiveFeedId()) { | |
188 | return f_ctx.viewfeed(getActiveFeedId(), "ForceUpdate"); | |
189 | } | |
190 | } | |
191 | ||
192 | if (keycode == 65) { // a | |
193 | return m_ctx.toggleDispRead(); | |
194 | } | |
195 | ||
196 | var f_doc = m_ctx.frames["feeds-frame"].document; | |
197 | var feedlist = f_doc.getElementById('feedList'); | |
198 | ||
199 | if (keycode == 74) { // j | |
200 | var feed = getActiveFeedId(); | |
201 | var new_feed = getRelativeFeedId(feedlist, feed, 'prev'); | |
202 | if (new_feed) viewfeed(new_feed, ''); | |
203 | } | |
204 | ||
205 | if (keycode == 75) { // k | |
206 | var feed = getActiveFeedId(); | |
207 | var new_feed = getRelativeFeedId(feedlist, feed, 'next'); | |
208 | if (new_feed) viewfeed(new_feed, ''); | |
209 | } | |
210 | ||
211 | if (keycode == 78 || keycode == 40) { // n, down | |
212 | if (typeof h_ctx.moveToPost != 'undefined') { | |
213 | return h_ctx.moveToPost('next'); | |
214 | } | |
215 | } | |
216 | ||
217 | if (keycode == 80 || keycode == 38) { // p, up | |
218 | if (typeof h_ctx.moveToPost != 'undefined') { | |
219 | return h_ctx.moveToPost('prev'); | |
220 | } | |
221 | } | |
222 | ||
223 | if (typeof localHotkeyHandler != 'undefined') { | |
224 | try { | |
225 | localHotkeyHandler(keycode); | |
226 | } catch (e) { | |
227 | exception_error("hotkey_handler, local:", e); | |
228 | } | |
229 | } | |
230 | } catch (e) { | |
231 | exception_error("hotkey_handler", e); | |
232 | } | |
233 | } | |
234 | ||
235 | function cleanSelectedList(element) { | |
236 | var content = document.getElementById(element); | |
237 | ||
238 | if (!document.getElementById("feedCatHolder")) { | |
239 | for (i = 0; i < content.childNodes.length; i++) { | |
240 | var child = content.childNodes[i]; | |
241 | try { | |
242 | child.className = child.className.replace("Selected", ""); | |
243 | } catch (e) { | |
244 | // | |
245 | } | |
246 | } | |
247 | } else { | |
248 | for (i = 0; i < content.childNodes.length; i++) { | |
249 | var child = content.childNodes[i]; | |
250 | if (child.id == "feedCatHolder") { | |
251 | parent.debug(child.id); | |
252 | var fcat = child.lastChild; | |
253 | for (j = 0; j < fcat.childNodes.length; j++) { | |
254 | var feed = fcat.childNodes[j]; | |
255 | feed.className = feed.className.replace("Selected", ""); | |
256 | } | |
257 | } | |
258 | } | |
259 | } | |
260 | } | |
261 | ||
262 | ||
263 | function cleanSelected(element) { | |
264 | var content = document.getElementById(element); | |
265 | ||
266 | for (i = 0; i < content.rows.length; i++) { | |
267 | content.rows[i].className = content.rows[i].className.replace("Selected", ""); | |
268 | } | |
269 | } | |
270 | ||
271 | function getVisibleUnreadHeadlines() { | |
272 | var content = document.getElementById("headlinesList"); | |
273 | ||
274 | var rows = new Array(); | |
275 | ||
276 | for (i = 0; i < content.rows.length; i++) { | |
277 | var row_id = content.rows[i].id.replace("RROW-", ""); | |
278 | if (row_id.length > 0 && content.rows[i].className.match("Unread")) { | |
279 | rows.push(row_id); | |
280 | } | |
281 | } | |
282 | return rows; | |
283 | } | |
284 | ||
285 | function getVisibleHeadlineIds() { | |
286 | ||
287 | var content = document.getElementById("headlinesList"); | |
288 | ||
289 | var rows = new Array(); | |
290 | ||
291 | for (i = 0; i < content.rows.length; i++) { | |
292 | var row_id = content.rows[i].id.replace("RROW-", ""); | |
293 | if (row_id.length > 0) { | |
294 | rows.push(row_id); | |
295 | } | |
296 | } | |
297 | return rows; | |
298 | } | |
299 | ||
300 | function getFirstVisibleHeadlineId() { | |
301 | var rows = getVisibleHeadlineIds(); | |
302 | return rows[0]; | |
303 | } | |
304 | ||
305 | function getLastVisibleHeadlineId() { | |
306 | var rows = getVisibleHeadlineIds(); | |
307 | return rows[rows.length-1]; | |
308 | } | |
309 | ||
310 | function markHeadline(id) { | |
311 | var row = document.getElementById("RROW-" + id); | |
312 | if (row) { | |
313 | var is_active = false; | |
314 | ||
315 | if (row.className.match("Active")) { | |
316 | is_active = true; | |
317 | } | |
318 | row.className = row.className.replace("Selected", ""); | |
319 | row.className = row.className.replace("Active", ""); | |
320 | row.className = row.className.replace("Insensitive", ""); | |
321 | ||
322 | if (is_active) { | |
323 | row.className = row.className = "Active"; | |
324 | } | |
325 | ||
326 | var check = document.getElementById("RCHK-" + id); | |
327 | ||
328 | if (check) { | |
329 | check.checked = true; | |
330 | } | |
331 | ||
332 | row.className = row.className + "Selected"; | |
333 | ||
334 | } | |
335 | } | |
336 | ||
337 | function getFeedIds() { | |
338 | var content = document.getElementById("feedsList"); | |
339 | ||
340 | var rows = new Array(); | |
341 | ||
342 | for (i = 0; i < content.rows.length; i++) { | |
343 | var id = content.rows[i].id.replace("FEEDR-", ""); | |
344 | if (id.length > 0) { | |
345 | rows.push(id); | |
346 | } | |
347 | } | |
348 | ||
349 | return rows; | |
350 | } | |
351 | ||
352 | function setCookie(name, value, lifetime, path, domain, secure) { | |
353 | ||
354 | var d = false; | |
355 | ||
356 | if (lifetime) { | |
357 | d = new Date(); | |
358 | d.setTime(lifetime * 1000); | |
359 | } | |
360 | ||
361 | int_setCookie(name, value, d, path, domain, secure); | |
362 | ||
363 | } | |
364 | ||
365 | function int_setCookie(name, value, expires, path, domain, secure) { | |
366 | document.cookie= name + "=" + escape(value) + | |
367 | ((expires) ? "; expires=" + expires.toGMTString() : "") + | |
368 | ((path) ? "; path=" + path : "") + | |
369 | ((domain) ? "; domain=" + domain : "") + | |
370 | ((secure) ? "; secure" : ""); | |
371 | } | |
372 | ||
373 | function delCookie(name, path, domain) { | |
374 | if (getCookie(name)) { | |
375 | document.cookie = name + "=" + | |
376 | ((path) ? ";path=" + path : "") + | |
377 | ((domain) ? ";domain=" + domain : "" ) + | |
378 | ";expires=Thu, 01-Jan-1970 00:00:01 GMT"; | |
379 | } | |
380 | } | |
381 | ||
382 | ||
383 | function getCookie(name) { | |
384 | ||
385 | var dc = document.cookie; | |
386 | var prefix = name + "="; | |
387 | var begin = dc.indexOf("; " + prefix); | |
388 | if (begin == -1) { | |
389 | begin = dc.indexOf(prefix); | |
390 | if (begin != 0) return null; | |
391 | } | |
392 | else { | |
393 | begin += 2; | |
394 | } | |
395 | var end = document.cookie.indexOf(";", begin); | |
396 | if (end == -1) { | |
397 | end = dc.length; | |
398 | } | |
399 | return unescape(dc.substring(begin + prefix.length, end)); | |
400 | } | |
401 | ||
402 | function disableContainerChildren(id, disable, doc) { | |
403 | ||
404 | if (!doc) doc = document; | |
405 | ||
406 | var container = doc.getElementById(id); | |
407 | ||
408 | if (!container) { | |
409 | //alert("disableContainerChildren: element " + id + " not found"); | |
410 | return; | |
411 | } | |
412 | ||
413 | for (var i = 0; i < container.childNodes.length; i++) { | |
414 | var child = container.childNodes[i]; | |
415 | ||
416 | try { | |
417 | child.disabled = disable; | |
418 | } catch (E) { | |
419 | ||
420 | } | |
421 | ||
422 | if (disable) { | |
423 | if (child.className && child.className.match("button")) { | |
424 | child.className = "disabledButton"; | |
425 | } | |
426 | } else { | |
427 | if (child.className && child.className.match("disabledButton")) { | |
428 | child.className = "button"; | |
429 | } | |
430 | } | |
431 | } | |
432 | ||
433 | } | |
434 | ||
435 | function gotoPreferences() { | |
436 | document.location.href = "prefs.php"; | |
437 | } | |
438 | ||
439 | function gotoMain() { | |
440 | document.location.href = "tt-rss.php"; | |
441 | } | |
442 | ||
443 | function gotoExportOpml() { | |
444 | document.location.href = "opml.php?op=Export"; | |
445 | } | |
446 | ||
447 | function getActiveFeedId() { | |
448 | // return getCookie("ttrss_vf_actfeed"); | |
449 | try { | |
450 | debug("gAFID: " + getMainContext().active_feed_id); | |
451 | return getMainContext().active_feed_id; | |
452 | } catch (e) { | |
453 | exception_error("getActiveFeedId", e); | |
454 | } | |
455 | } | |
456 | ||
457 | function activeFeedIsCat() { | |
458 | return getMainContext().active_feed_is_cat; | |
459 | } | |
460 | ||
461 | function setActiveFeedId(id) { | |
462 | // return setCookie("ttrss_vf_actfeed", id); | |
463 | try { | |
464 | debug("sAFID(" + id + ")"); | |
465 | getMainContext().active_feed_id = id; | |
466 | } catch (e) { | |
467 | exception_error("setActiveFeedId", e); | |
468 | } | |
469 | } | |
470 | ||
471 | function parse_counters(reply, scheduled_call) { | |
472 | try { | |
473 | var f_document = document; | |
474 | var title_obj = this.window; | |
475 | ||
476 | var feeds_found = 0; | |
477 | ||
478 | if (reply.firstChild && reply.firstChild.firstChild) { | |
479 | debug("<b>wrong element passed to parse_counters, adjusting.</b>"); | |
480 | reply = reply.firstChild; | |
481 | } | |
482 | ||
483 | debug("F_DOC: " + f_document + ", T_OBJ: " + title_obj); | |
484 | ||
485 | for (var l = 0; l < reply.childNodes.length; l++) { | |
486 | if (!reply.childNodes[l] || | |
487 | typeof(reply.childNodes[l].getAttribute) == "undefined") { | |
488 | // where did this come from? | |
489 | continue; | |
490 | } | |
491 | ||
492 | var id = reply.childNodes[l].getAttribute("id"); | |
493 | var t = reply.childNodes[l].getAttribute("type"); | |
494 | var ctr = reply.childNodes[l].getAttribute("counter"); | |
495 | var error = reply.childNodes[l].getAttribute("error"); | |
496 | var has_img = reply.childNodes[l].getAttribute("hi"); | |
497 | var updated = reply.childNodes[l].getAttribute("updated"); | |
498 | ||
499 | if (id == "global-unread") { | |
500 | title_obj.global_unread = ctr; | |
501 | title_obj.updateTitle(); | |
502 | continue; | |
503 | } | |
504 | ||
505 | if (id == "subscribed-feeds") { | |
506 | feeds_found = ctr; | |
507 | continue; | |
508 | } | |
509 | ||
510 | if (t == "category") { | |
511 | var catctr = f_document.getElementById("FCATCTR-" + id); | |
512 | if (catctr) { | |
513 | catctr.innerHTML = "(" + ctr + " unread)"; | |
514 | } | |
515 | continue; | |
516 | } | |
517 | ||
518 | var feedctr = f_document.getElementById("FEEDCTR-" + id); | |
519 | var feedu = f_document.getElementById("FEEDU-" + id); | |
520 | var feedr = f_document.getElementById("FEEDR-" + id); | |
521 | var feed_img = f_document.getElementById("FIMG-" + id); | |
522 | var feedlink = f_document.getElementById("FEEDL-" + id); | |
523 | var feedupd = f_document.getElementById("FLUPD-" + id); | |
524 | ||
525 | if (updated && feedlink) { | |
526 | if (error) { | |
527 | feedlink.title = "Error: " + error + " (" + updated + ")"; | |
528 | } else { | |
529 | feedlink.title = "Updated: " + updated; | |
530 | } | |
531 | } | |
532 | ||
533 | if (updated && feedupd) { | |
534 | if (error) { | |
535 | feedupd.innerHTML = updated + " (Error)"; | |
536 | } else { | |
537 | feedupd.innerHTML = updated; | |
538 | } | |
539 | } | |
540 | ||
541 | if (feedctr && feedu && feedr) { | |
542 | ||
543 | if (feedu.innerHTML != ctr && id == getActiveFeedId() && scheduled_call) { | |
544 | var hf = title_obj.parent.frames["headlines-frame"]; | |
545 | hf.location.reload(true); | |
546 | } | |
547 | ||
548 | feedu.innerHTML = ctr; | |
549 | ||
550 | if (error) { | |
551 | feedr.className = feedr.className.replace("feed", "error"); | |
552 | } else if (id > 0) { | |
553 | feedr.className = feedr.className.replace("error", "feed"); | |
554 | } | |
555 | ||
556 | if (ctr > 0) { | |
557 | feedctr.className = "odd"; | |
558 | if (!feedr.className.match("Unread")) { | |
559 | var is_selected = feedr.className.match("Selected"); | |
560 | ||
561 | feedr.className = feedr.className.replace("Selected", ""); | |
562 | feedr.className = feedr.className.replace("Unread", ""); | |
563 | ||
564 | feedr.className = feedr.className + "Unread"; | |
565 | ||
566 | if (is_selected) { | |
567 | feedr.className = feedr.className + "Selected"; | |
568 | } | |
569 | ||
570 | } | |
571 | } else { | |
572 | feedctr.className = "invisible"; | |
573 | feedr.className = feedr.className.replace("Unread", ""); | |
574 | } | |
575 | } | |
576 | } | |
577 | ||
578 | hideOrShowFeeds(getFeedsContext().document, | |
579 | getInitParam("hide_read_feeds") == 1); | |
580 | ||
581 | var feeds_stored = getMainContext().number_of_feeds; | |
582 | ||
583 | debug("Feed counters, C: " + feeds_found + ", S:" + feeds_stored); | |
584 | ||
585 | if (feeds_stored != feeds_found) { | |
586 | getMainContext().number_of_feeds = feeds_found; | |
587 | ||
588 | if (feeds_stored != 0) { | |
589 | debug("Subscribed feed number changed, refreshing feedlist"); | |
590 | updateFeedList(); | |
591 | } | |
592 | } | |
593 | ||
594 | } catch (e) { | |
595 | exception_error("parse_counters", e); | |
596 | } | |
597 | } | |
598 | ||
599 | function all_counters_callback() { | |
600 | if (xmlhttp_rpc.readyState == 4) { | |
601 | try { | |
602 | if (!xmlhttp_rpc.responseXML || !xmlhttp_rpc.responseXML.firstChild) { | |
603 | debug("[all_counters_callback] backend did not return valid XML"); | |
604 | return; | |
605 | } | |
606 | ||
607 | debug("in all_counters_callback : " + xmlhttp_rpc.responseXML); | |
608 | ||
609 | var reply = xmlhttp_rpc.responseXML.firstChild; | |
610 | ||
611 | var counters = reply.firstChild; | |
612 | ||
613 | parse_counters(counters); | |
614 | ||
615 | var runtime = counters.nextSibling; | |
616 | ||
617 | if (runtime) { | |
618 | getMainContext().parse_runtime_info(runtime); | |
619 | } | |
620 | ||
621 | if (getInitParam("feeds_sort_by_unread") == 1) { | |
622 | resort_feedlist(); | |
623 | } | |
624 | ||
625 | hideOrShowFeeds(document, getInitParam("hide_read_feeds") == 1); | |
626 | ||
627 | } catch (e) { | |
628 | exception_error("all_counters_callback", e); | |
629 | } | |
630 | } | |
631 | } | |
632 | ||
633 | function get_feed_entry_unread(doc, elem) { | |
634 | ||
635 | var id = elem.id.replace("FEEDR-", ""); | |
636 | ||
637 | if (id <= 0) { | |
638 | return -1; | |
639 | } | |
640 | ||
641 | try { | |
642 | return parseInt(doc.getElementById("FEEDU-" + id).innerHTML); | |
643 | } catch (e) { | |
644 | return -1; | |
645 | } | |
646 | } | |
647 | ||
648 | function resort_category(doc, node) { | |
649 | debug("resort_category: " + node); | |
650 | ||
651 | if (node.hasChildNodes() && node.firstChild.nextSibling != false) { | |
652 | for (i = 0; i < node.childNodes.length; i++) { | |
653 | if (node.childNodes[i].nodeName != "LI") { continue; } | |
654 | ||
655 | if (get_feed_entry_unread(doc, node.childNodes[i]) < 0) { | |
656 | continue; | |
657 | } | |
658 | ||
659 | for (j = i+1; j < node.childNodes.length; j++) { | |
660 | if (node.childNodes[j].nodeName != "LI") { continue; } | |
661 | ||
662 | var tmp_val = get_feed_entry_unread(doc, node.childNodes[i]); | |
663 | var cur_val = get_feed_entry_unread(doc, node.childNodes[j]); | |
664 | ||
665 | if (cur_val > tmp_val) { | |
666 | tempnode_i = node.childNodes[i].cloneNode(true); | |
667 | tempnode_j = node.childNodes[j].cloneNode(true); | |
668 | node.replaceChild(tempnode_i, node.childNodes[j]); | |
669 | node.replaceChild(tempnode_j, node.childNodes[i]); | |
670 | } | |
671 | } | |
672 | ||
673 | } | |
674 | } | |
675 | ||
676 | } | |
677 | ||
678 | function resort_feedlist() { | |
679 | debug("resort_feedlist"); | |
680 | ||
681 | var fd = getFeedsContext().document; | |
682 | ||
683 | if (fd.getElementById("feedCatHolder")) { | |
684 | ||
685 | var feeds = fd.getElementById("feedList"); | |
686 | var child = feeds.firstChild; | |
687 | ||
688 | while (child) { | |
689 | ||
690 | if (child.id == "feedCatHolder") { | |
691 | resort_category(fd, child.firstChild); | |
692 | } | |
693 | ||
694 | child = child.nextSibling; | |
695 | } | |
696 | ||
697 | } else { | |
698 | resort_category(fd, fd.getElementById("feedList")); | |
699 | } | |
700 | } | |
701 | ||
702 | function update_all_counters(feed) { | |
703 | if (xmlhttp_ready(xmlhttp_rpc)) { | |
704 | var query = "backend.php?op=rpc&subop=getAllCounters"; | |
705 | ||
706 | if (feed > 0) { | |
707 | query = query + "&aid=" + feed; | |
708 | } | |
709 | ||
710 | xmlhttp_rpc.open("GET", query, true); | |
711 | xmlhttp_rpc.onreadystatechange=all_counters_callback; | |
712 | xmlhttp_rpc.send(null); | |
713 | } | |
714 | } | |
715 | ||
716 | function popupHelp(tid) { | |
717 | var w = window.open("backend.php?op=help&tid=" + tid, | |
718 | "Popup Help", | |
719 | "menubar=no,location=no,resizable=yes,scrollbars=yes,status=no"); | |
720 | } | |
721 | ||
722 | /** * @(#)isNumeric.js * * Copyright (c) 2000 by Sundar Dorai-Raj | |
723 | * * @author Sundar Dorai-Raj | |
724 | * * Email: sdoraira@vt.edu | |
725 | * * This program is free software; you can redistribute it and/or | |
726 | * * modify it under the terms of the GNU General Public License | |
727 | * * as published by the Free Software Foundation; either version 2 | |
728 | * * of the License, or (at your option) any later version, | |
729 | * * provided that any use properly credits the author. | |
730 | * * This program is distributed in the hope that it will be useful, | |
731 | * * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
732 | * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
733 | * * GNU General Public License for more details at http://www.gnu.org * * */ | |
734 | ||
735 | var numbers=".0123456789"; | |
736 | function isNumeric(x) { | |
737 | // is x a String or a character? | |
738 | if(x.length>1) { | |
739 | // remove negative sign | |
740 | x=Math.abs(x)+""; | |
741 | for(j=0;j<x.length;j++) { | |
742 | // call isNumeric recursively for each character | |
743 | number=isNumeric(x.substring(j,j+1)); | |
744 | if(!number) return number; | |
745 | } | |
746 | return number; | |
747 | } | |
748 | else { | |
749 | // if x is number return true | |
750 | if(numbers.indexOf(x)>=0) return true; | |
751 | return false; | |
752 | } | |
753 | } | |
754 | ||
755 | ||
756 | function hideOrShowFeeds(doc, hide) { | |
757 | ||
758 | debug("hideOrShowFeeds: " + doc + ", " + hide); | |
759 | ||
760 | var fd = getFeedsContext().document; | |
761 | ||
762 | var list = fd.getElementById("feedList"); | |
763 | ||
764 | if (fd.getElementById("feedCatHolder")) { | |
765 | ||
766 | var feeds = fd.getElementById("feedList"); | |
767 | var child = feeds.firstChild; | |
768 | ||
769 | while (child) { | |
770 | ||
771 | if (child.id == "feedCatHolder") { | |
772 | hideOrShowFeedsCategory(fd, child.firstChild, hide, child.previousSibling); | |
773 | } | |
774 | ||
775 | child = child.nextSibling; | |
776 | } | |
777 | ||
778 | } else { | |
779 | hideOrShowFeedsCategory(fd, fd.getElementById("feedList"), hide); | |
780 | } | |
781 | } | |
782 | ||
783 | function hideOrShowFeedsCategory(doc, node, hide, cat_node) { | |
784 | ||
785 | // debug("hideOrShowFeedsCategory: " + node + " (" + hide + ")"); | |
786 | ||
787 | var cat_unread = 0; | |
788 | ||
789 | if (node.hasChildNodes() && node.firstChild.nextSibling != false) { | |
790 | for (i = 0; i < node.childNodes.length; i++) { | |
791 | if (node.childNodes[i].nodeName != "LI") { continue; } | |
792 | ||
793 | if (node.childNodes[i].style != undefined) { | |
794 | ||
795 | var has_unread = (node.childNodes[i].className != "feed"); | |
796 | ||
797 | // debug(node.childNodes[i].id + " --> " + has_unread); | |
798 | ||
799 | if (hide && !has_unread) { | |
800 | node.childNodes[i].style.display = "none"; | |
801 | } | |
802 | ||
803 | if (!hide) { | |
804 | node.childNodes[i].style.display = "list-item"; | |
805 | } | |
806 | ||
807 | if (has_unread) { | |
808 | node.childNodes[i].style.display = "list-item"; | |
809 | cat_unread++; | |
810 | } | |
811 | } | |
812 | } | |
813 | } | |
814 | ||
815 | if (cat_unread == 0) { | |
816 | if (cat_node.style == undefined) { | |
817 | debug("ERROR: supplied cat_node " + cat_node + | |
818 | " has no styles. WTF?"); | |
819 | return; | |
820 | } | |
821 | if (hide) { | |
822 | cat_node.style.display = "none"; | |
823 | } else { | |
824 | cat_node.style.display = "list-item"; | |
825 | } | |
826 | } else { | |
827 | try { | |
828 | cat_node.style.display = "list-item"; | |
829 | } catch (e) { | |
830 | debug(e); | |
831 | } | |
832 | } | |
833 | ||
834 | // debug("unread for category: " + cat_unread); | |
835 | } | |
836 | ||
837 | function selectTableRow(r, do_select) { | |
838 | r.className = r.className.replace("Selected", ""); | |
839 | ||
840 | if (do_select) { | |
841 | r.className = r.className + "Selected"; | |
842 | } | |
843 | } | |
844 | ||
845 | function selectTableRowById(elem_id, check_id, do_select) { | |
846 | ||
847 | try { | |
848 | ||
849 | var row = document.getElementById(elem_id); | |
850 | ||
851 | if (row) { | |
852 | selectTableRow(row, do_select); | |
853 | } | |
854 | ||
855 | var check = document.getElementById(check_id); | |
856 | ||
857 | if (check) { | |
858 | check.checked = do_select; | |
859 | } | |
860 | } catch (e) { | |
861 | exception_error("selectTableRowById", e); | |
862 | } | |
863 | } | |
864 | ||
865 | function selectTableRowsByIdPrefix(content_id, prefix, check_prefix, do_select, | |
866 | classcheck, reset_others) { | |
867 | ||
868 | var content = document.getElementById(content_id); | |
869 | ||
870 | if (!content) { | |
871 | alert("[selectTableRows] Element " + content_id + " not found."); | |
872 | return; | |
873 | } | |
874 | ||
875 | for (i = 0; i < content.rows.length; i++) { | |
876 | if (!classcheck || content.rows[i].className.match(classcheck)) { | |
877 | ||
878 | if (content.rows[i].id.match(prefix)) { | |
879 | selectTableRow(content.rows[i], do_select); | |
880 | ||
881 | var row_id = content.rows[i].id.replace(prefix, ""); | |
882 | var check = document.getElementById(check_prefix + row_id); | |
883 | ||
884 | if (check) { | |
885 | check.checked = do_select; | |
886 | } | |
887 | } else if (reset_others) { | |
888 | selectTableRow(content.rows[i], false); | |
889 | ||
890 | var row_id = content.rows[i].id.replace(prefix, ""); | |
891 | var check = document.getElementById(check_prefix + row_id); | |
892 | ||
893 | if (check) { | |
894 | check.checked = false; | |
895 | } | |
896 | ||
897 | } | |
898 | } else if (reset_others) { | |
899 | selectTableRow(content.rows[i], false); | |
900 | ||
901 | var row_id = content.rows[i].id.replace(prefix, ""); | |
902 | var check = document.getElementById(check_prefix + row_id); | |
903 | ||
904 | if (check) { | |
905 | check.checked = false; | |
906 | } | |
907 | ||
908 | } | |
909 | } | |
910 | } | |
911 | ||
912 | function getSelectedTableRowIds(content_id, prefix) { | |
913 | ||
914 | var content = document.getElementById(content_id); | |
915 | ||
916 | if (!content) { | |
917 | alert("[getSelectedTableRowIds] Element " + content_id + " not found."); | |
918 | return; | |
919 | } | |
920 | ||
921 | var sel_rows = new Array(); | |
922 | ||
923 | for (i = 0; i < content.rows.length; i++) { | |
924 | if (content.rows[i].id.match(prefix) && | |
925 | content.rows[i].className.match("Selected")) { | |
926 | ||
927 | var row_id = content.rows[i].id.replace(prefix + "-", ""); | |
928 | sel_rows.push(row_id); | |
929 | } | |
930 | } | |
931 | ||
932 | return sel_rows; | |
933 | ||
934 | } | |
935 | ||
936 | function toggleSelectRowById(sender, id) { | |
937 | var row = document.getElementById(id); | |
938 | ||
939 | if (sender.checked) { | |
940 | if (!row.className.match("Selected")) { | |
941 | row.className = row.className + "Selected"; | |
942 | } | |
943 | } else { | |
944 | if (row.className.match("Selected")) { | |
945 | row.className = row.className.replace("Selected", ""); | |
946 | } | |
947 | } | |
948 | } | |
949 | ||
950 | function toggleSelectListRow(sender) { | |
951 | var parent_row = sender.parentNode; | |
952 | ||
953 | if (sender.checked) { | |
954 | if (!parent_row.className.match("Selected")) { | |
955 | parent_row.className = parent_row.className + "Selected"; | |
956 | } | |
957 | } else { | |
958 | if (parent_row.className.match("Selected")) { | |
959 | parent_row.className = parent_row.className.replace("Selected", ""); | |
960 | } | |
961 | } | |
962 | } | |
963 | ||
964 | ||
965 | function toggleSelectRow(sender) { | |
966 | var parent_row = sender.parentNode.parentNode; | |
967 | ||
968 | if (sender.checked) { | |
969 | if (!parent_row.className.match("Selected")) { | |
970 | parent_row.className = parent_row.className + "Selected"; | |
971 | } | |
972 | } else { | |
973 | if (parent_row.className.match("Selected")) { | |
974 | parent_row.className = parent_row.className.replace("Selected", ""); | |
975 | } | |
976 | } | |
977 | } | |
978 | ||
979 | function openExternalUrl(url) { | |
980 | var w = window.open(url); | |
981 | } | |
982 | ||
983 | function getRelativeFeedId(list, id, direction, unread_only) { | |
984 | if (!id) { | |
985 | if (direction == "next") { | |
986 | for (i = 0; i < list.childNodes.length; i++) { | |
987 | var child = list.childNodes[i]; | |
988 | if (child.id && child.id == "feedCatHolder") { | |
989 | if (child.lastChild) { | |
990 | var cr = getRelativeFeedId(child.firstChild, id, direction); | |
991 | if (cr) return cr; | |
992 | } | |
993 | } else if (child.id && child.id.match("FEEDR-")) { | |
994 | return child.id.replace('FEEDR-', ''); | |
995 | } | |
996 | } | |
997 | } | |
998 | ||
999 | // FIXME select last feed doesn't work when only unread feeds are visible | |
1000 | ||
1001 | if (direction == "prev") { | |
1002 | for (i = list.childNodes.length-1; i >= 0; i--) { | |
1003 | var child = list.childNodes[i]; | |
1004 | if (child.id == "feedCatHolder") { | |
1005 | if (child.firstChild) { | |
1006 | var cr = getRelativeFeedId(child.firstChild, id, direction); | |
1007 | if (cr) return cr; | |
1008 | } | |
1009 | } else if (child.id.match("FEEDR-")) { | |
1010 | ||
1011 | if (getInitParam("hide_read_feeds") == 1) { | |
1012 | if (child.className != "feed") { | |
1013 | alert(child.className); | |
1014 | return child.id.replace('FEEDR-', ''); | |
1015 | } | |
1016 | } else { | |
1017 | return child.id.replace('FEEDR-', ''); | |
1018 | } | |
1019 | } | |
1020 | } | |
1021 | } | |
1022 | } else { | |
1023 | ||
1024 | var feed = list.ownerDocument.getElementById("FEEDR-" + getActiveFeedId()); | |
1025 | ||
1026 | if (getInitParam("hide_read_feeds") == 1) { | |
1027 | unread_only = true; | |
1028 | } | |
1029 | ||
1030 | if (direction == "next") { | |
1031 | ||
1032 | var e = feed; | |
1033 | ||
1034 | while (e) { | |
1035 | ||
1036 | if (e.nextSibling) { | |
1037 | ||
1038 | e = e.nextSibling; | |
1039 | ||
1040 | } else if (e.parentNode.parentNode.nextSibling) { | |
1041 | ||
1042 | var this_cat = e.parentNode.parentNode; | |
1043 | ||
1044 | e = false; | |
1045 | ||
1046 | if (this_cat && this_cat.nextSibling) { | |
1047 | while (!e && this_cat.nextSibling) { | |
1048 | this_cat = this_cat.nextSibling; | |
1049 | if (this_cat.id == "feedCatHolder") { | |
1050 | e = this_cat.firstChild.firstChild; | |
1051 | } | |
1052 | } | |
1053 | } | |
1054 | ||
1055 | } else { | |
1056 | e = false; | |
1057 | } | |
1058 | ||
1059 | if (e) { | |
1060 | if (!unread_only || (unread_only && e.className != "feed" && | |
1061 | e.className != "error")) { | |
1062 | return e.id.replace("FEEDR-", ""); | |
1063 | } | |
1064 | } | |
1065 | } | |
1066 | ||
1067 | } else if (direction == "prev") { | |
1068 | ||
1069 | var e = feed; | |
1070 | ||
1071 | while (e) { | |
1072 | ||
1073 | if (e.previousSibling) { | |
1074 | ||
1075 | e = e.previousSibling; | |
1076 | ||
1077 | } else if (e.parentNode.parentNode.previousSibling) { | |
1078 | ||
1079 | var this_cat = e.parentNode.parentNode; | |
1080 | ||
1081 | e = false; | |
1082 | ||
1083 | if (this_cat && this_cat.previousSibling) { | |
1084 | while (!e && this_cat.previousSibling) { | |
1085 | this_cat = this_cat.previousSibling; | |
1086 | if (this_cat.id == "feedCatHolder") { | |
1087 | e = this_cat.firstChild.lastChild; | |
1088 | } | |
1089 | } | |
1090 | } | |
1091 | ||
1092 | } else { | |
1093 | e = false; | |
1094 | } | |
1095 | ||
1096 | if (e) { | |
1097 | if (!unread_only || (unread_only && e.className != "feed" && | |
1098 | e.className != "error")) { | |
1099 | return e.id.replace("FEEDR-", ""); | |
1100 | } | |
1101 | } | |
1102 | } | |
1103 | } | |
1104 | } | |
1105 | } | |
1106 | ||
1107 | function showBlockElement(id) { | |
1108 | var elem = document.getElementById(id); | |
1109 | ||
1110 | if (elem) { | |
1111 | elem.style.display = "block"; | |
1112 | } else { | |
1113 | alert("[showBlockElement] can't find element with id " + id); | |
1114 | } | |
1115 | } | |
1116 | ||
1117 | function hideParentElement(e) { | |
1118 | e.parentNode.style.display = "none"; | |
1119 | } | |
1120 | ||
1121 | function dropboxSelect(e, v) { | |
1122 | for (i = 0; i < e.length; i++) { | |
1123 | if (e[i].value == v) { | |
1124 | e.selectedIndex = i; | |
1125 | break; | |
1126 | } | |
1127 | } | |
1128 | } | |
1129 | ||
1130 | // originally stolen from http://www.11tmr.com/11tmr.nsf/d6plinks/MWHE-695L9Z | |
1131 | // bugfixed just a little bit :-) | |
1132 | function getURLParam(strParamName){ | |
1133 | var strReturn = ""; | |
1134 | var strHref = window.location.href; | |
1135 | ||
1136 | if (strHref.indexOf("#") == strHref.length-1) { | |
1137 | strHref = strHref.substring(0, strHref.length-1); | |
1138 | } | |
1139 | ||
1140 | if ( strHref.indexOf("?") > -1 ){ | |
1141 | var strQueryString = strHref.substr(strHref.indexOf("?")); | |
1142 | var aQueryString = strQueryString.split("&"); | |
1143 | for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){ | |
1144 | if (aQueryString[iParam].indexOf(strParamName + "=") > -1 ){ | |
1145 | var aParam = aQueryString[iParam].split("="); | |
1146 | strReturn = aParam[1]; | |
1147 | break; | |
1148 | } | |
1149 | } | |
1150 | } | |
1151 | return strReturn; | |
1152 | } | |
1153 | ||
1154 | function leading_zero(p) { | |
1155 | var s = String(p); | |
1156 | if (s.length == 1) s = "0" + s; | |
1157 | return s; | |
1158 | } | |
1159 | ||
1160 | function closeInfoBox(cleanup) { | |
1161 | var box = document.getElementById('infoBox'); | |
1162 | var shadow = document.getElementById('infoBoxShadow'); | |
1163 | ||
1164 | if (shadow) { | |
1165 | shadow.style.display = "none"; | |
1166 | } else if (box) { | |
1167 | box.style.display = "none"; | |
1168 | } | |
1169 | ||
1170 | if (cleanup) box.innerHTML = " "; | |
1171 | ||
1172 | enableHotkeys(); | |
1173 | ||
1174 | return false; | |
1175 | } | |
1176 | ||
1177 | ||
1178 | function displayDlg(id, param) { | |
1179 | ||
1180 | if (!xmlhttp_ready(xmlhttp)) { | |
1181 | printLockingError(); | |
1182 | return | |
1183 | } | |
1184 | ||
1185 | notify(""); | |
1186 | ||
1187 | xmlhttp.open("GET", "backend.php?op=dlg&id=" + | |
1188 | param_escape(id) + "¶m=" + param_escape(param), true); | |
1189 | xmlhttp.onreadystatechange=infobox_callback; | |
1190 | xmlhttp.send(null); | |
1191 | ||
1192 | disableHotkeys(); | |
1193 | ||
1194 | return false; | |
1195 | } | |
1196 | ||
1197 | function infobox_submit_callback() { | |
1198 | if (xmlhttp.readyState == 4) { | |
1199 | closeInfoBox(); | |
1200 | ||
1201 | // called from prefs, reload tab | |
1202 | if (active_tab) { | |
1203 | selectTab(active_tab, false); | |
1204 | } | |
1205 | ||
1206 | notify(xmlhttp.responseText); | |
1207 | ||
1208 | } | |
1209 | } | |
1210 | ||
1211 | function infobox_callback() { | |
1212 | if (xmlhttp.readyState == 4) { | |
1213 | var box = document.getElementById('infoBox'); | |
1214 | var shadow = document.getElementById('infoBoxShadow'); | |
1215 | if (box) { | |
1216 | box.innerHTML=xmlhttp.responseText; | |
1217 | if (shadow) { | |
1218 | shadow.style.display = "block"; | |
1219 | } else { | |
1220 | box.style.display = "block"; | |
1221 | } | |
1222 | } | |
1223 | } | |
1224 | } | |
1225 | ||
1226 | function qaddFilter() { | |
1227 | ||
1228 | if (!xmlhttp_ready(xmlhttp)) { | |
1229 | printLockingError(); | |
1230 | return | |
1231 | } | |
1232 | ||
1233 | var query = Form.serialize("filter_add_form"); | |
1234 | ||
1235 | xmlhttp.open("GET", "backend.php?" + query, true); | |
1236 | xmlhttp.onreadystatechange=infobox_submit_callback; | |
1237 | xmlhttp.send(null); | |
1238 | ||
1239 | return true; | |
1240 | } | |
1241 | ||
1242 | function toggleSubmitNotEmpty(e, submit_id) { | |
1243 | try { | |
1244 | document.getElementById(submit_id).disabled = (e.value == "") | |
1245 | } catch (e) { | |
1246 | exception_error("toggleSubmitNotEmpty", e); | |
1247 | } | |
1248 | } | |
1249 | ||
1250 | function isValidURL(s) { | |
1251 | return s.match("http://") != null || s.match("https://") != null; | |
1252 | } | |
1253 | ||
1254 | function qafAdd() { | |
1255 | ||
1256 | if (!xmlhttp_ready(xmlhttp)) { | |
1257 | printLockingError(); | |
1258 | return | |
1259 | } | |
1260 | ||
1261 | notify("Adding feed..."); | |
1262 | ||
1263 | closeInfoBox(); | |
1264 | ||
1265 | var feeds_doc = getFeedsContext().document; | |
1266 | ||
1267 | // feeds_doc.location.href = "backend.php?op=error&msg=Loading,%20please wait..."; | |
1268 | ||
1269 | var query = Form.serialize("feed_add_form"); | |
1270 | ||
1271 | xmlhttp.open("GET", "backend.php?" + query, true); | |
1272 | xmlhttp.onreadystatechange=dlg_frefresh_callback; | |
1273 | xmlhttp.send(null); | |
1274 | } | |
1275 | ||
1276 | function filterCR(e) | |
1277 | { | |
1278 | var key; | |
1279 | ||
1280 | if(window.event) | |
1281 | key = window.event.keyCode; //IE | |
1282 | else | |
1283 | key = e.which; //firefox | |
1284 | ||
1285 | if(key == 13) | |
1286 | return false; | |
1287 | else | |
1288 | return true; | |
1289 | } | |
1290 | ||
1291 | function getMainContext() { | |
1292 | return this.window; | |
1293 | } | |
1294 | ||
1295 | function getFeedsContext() { | |
1296 | return this.window; | |
1297 | } | |
1298 | ||
1299 | function getContentContext() { | |
1300 | return this.window; | |
1301 | } | |
1302 | ||
1303 | ||
1304 | function getHeadlinesContext() { | |
1305 | return this.window; | |
1306 | } | |
1307 | ||
1308 | var debug_last_class = "even"; | |
1309 | ||
1310 | function debug(msg) { | |
1311 | var ctx = getMainContext(); | |
1312 | ||
1313 | if (ctx.debug_last_class == "even") { | |
1314 | ctx.debug_last_class = "odd"; | |
1315 | } else { | |
1316 | ctx.debug_last_class = "even"; | |
1317 | } | |
1318 | ||
1319 | var c = ctx.document.getElementById('debug_output'); | |
1320 | if (c && c.style.display == "block") { | |
1321 | while (c.lastChild != 'undefined' && c.childNodes.length > 100) { | |
1322 | c.removeChild(c.lastChild); | |
1323 | } | |
1324 | ||
1325 | var d = new Date(); | |
1326 | var ts = leading_zero(d.getHours()) + ":" + leading_zero(d.getMinutes()) + | |
1327 | ":" + leading_zero(d.getSeconds()); | |
1328 | c.innerHTML = "<li class=\"" + ctx.debug_last_class + "\"><span class=\"debugTS\">[" + ts + "]</span> " + | |
1329 | msg + "</li>" + c.innerHTML; | |
1330 | } | |
1331 | } | |
1332 | ||
1333 | function getInitParam(key) { | |
1334 | return getMainContext().init_params[key]; | |
1335 | } | |
1336 | ||
1337 | function storeInitParam(key, value, is_client) { | |
1338 | try { | |
1339 | if (!is_client) { | |
1340 | if (getMainContext().init_params[key] != value) { | |
1341 | debug("storeInitParam: " + key + " => " + value); | |
1342 | //new Ajax.Request("backend.php?op=rpc&subop=storeParam&key=" + | |
1343 | // param_escape(key) + "&value=" + param_escape(value)); | |
1344 | var f = getMainContext().document.getElementById("backReqBox"); | |
1345 | f.src = "backend.php?op=rpc&subop=storeParam&key=" + | |
1346 | param_escape(key) + "&value=" + param_escape(value); | |
1347 | } | |
1348 | } | |
1349 | getMainContext().init_params[key] = value; | |
1350 | } catch (e) { | |
1351 | exception_error("storeInitParam", e); | |
1352 | } | |
1353 | } | |
1354 | ||
1355 | /* | |
1356 | function storeInitParams(params, is_client) { | |
1357 | try { | |
1358 | var s = ""; | |
1359 | ||
1360 | for (k in params) { | |
1361 | if (getMainContext().init_params[k] != params[k]) { | |
1362 | s += k + "=" + params[k] + ";"; | |
1363 | getMainContext().init_params[k] = params[k]; | |
1364 | } | |
1365 | } | |
1366 | ||
1367 | debug("storeInitParams: " + s); | |
1368 | ||
1369 | if (!is_client) { | |
1370 | new Ajax.Request("backend.php?op=rpc&subop=storeParams&str=" + s); | |
1371 | } | |
1372 | } catch (e) { | |
1373 | exception_error("storeInitParams", e); | |
1374 | } | |
1375 | }*/ | |
1376 | ||
1377 | function fatalError(code, message) { | |
1378 | try { | |
1379 | var fe = document.getElementById("fatal_error"); | |
1380 | var fc = document.getElementById("fatal_error_msg"); | |
1381 | ||
1382 | fc.innerHTML = "Code " + code + ": " + message; | |
1383 | ||
1384 | fe.style.display = "block"; | |
1385 | ||
1386 | } catch (e) { | |
1387 | exception_error("fatalError", e); | |
1388 | } | |
1389 | } | |
1390 | ||
1391 | function getFeedName(id, is_cat) { | |
1392 | var d = getFeedsContext().document; | |
1393 | ||
1394 | var e; | |
1395 | ||
1396 | if (is_cat) { | |
1397 | e = d.getElementById("FCATN-" + id); | |
1398 | } else { | |
1399 | e = d.getElementById("FEEDN-" + id); | |
1400 | } | |
1401 | if (e) { | |
1402 | return e.innerHTML.stripTags(); | |
1403 | } else { | |
1404 | return null; | |
1405 | } | |
1406 | } | |
1407 | ||
1408 | function viewContentUrl(url) { | |
1409 | getContentContext().location = url; | |
1410 | } |