]>
Commit | Line | Data |
---|---|---|
1 | var hotkeys_enabled = true; | |
2 | ||
3 | function exception_error(location, e) { | |
4 | var msg; | |
5 | ||
6 | if (e.fileName) { | |
7 | var base_fname = e.fileName.substring(e.fileName.lastIndexOf("/") + 1); | |
8 | ||
9 | msg = "Exception: " + e.name + ", " + e.message + | |
10 | "\nFunction: " + location + "()" + | |
11 | "\nLocation: " + base_fname + ":" + e.lineNumber; | |
12 | } else { | |
13 | msg = "Exception: " + e + "\nFunction: " + location + "()"; | |
14 | } | |
15 | ||
16 | alert(msg); | |
17 | } | |
18 | ||
19 | function disableHotkeys() { | |
20 | hotkeys_enabled = false; | |
21 | } | |
22 | ||
23 | function enableHotkeys() { | |
24 | hotkeys_enabled = true; | |
25 | } | |
26 | ||
27 | function xmlhttp_ready(obj) { | |
28 | return obj.readyState == 4 || obj.readyState == 0 || !obj.readyState; | |
29 | } | |
30 | ||
31 | ||
32 | function notify_callback() { | |
33 | var container = document.getElementById('notify'); | |
34 | if (xmlhttp.readyState == 4) { | |
35 | container.innerHTML=xmlhttp.responseText; | |
36 | } | |
37 | } | |
38 | ||
39 | function rpc_notify_callback() { | |
40 | var container = document.getElementById('notify'); | |
41 | if (xmlhttp_rpc.readyState == 4) { | |
42 | container.innerHTML=xmlhttp_rpc.responseText; | |
43 | } | |
44 | } | |
45 | ||
46 | function rpc_pnotify_callback() { | |
47 | var container = parent.document.getElementById('notify'); | |
48 | if (xmlhttp_rpc.readyState == 4) { | |
49 | container.innerHTML=xmlhttp_rpc.responseText; | |
50 | } | |
51 | } | |
52 | ||
53 | function param_escape(arg) { | |
54 | if (typeof encodeURIComponent != 'undefined') | |
55 | return encodeURIComponent(arg); | |
56 | else | |
57 | return escape(arg); | |
58 | } | |
59 | ||
60 | function param_unescape(arg) { | |
61 | if (typeof decodeURIComponent != 'undefined') | |
62 | return decodeURIComponent(arg); | |
63 | else | |
64 | return unescape(arg); | |
65 | } | |
66 | ||
67 | function delay(gap) { | |
68 | var then,now; | |
69 | then=new Date().getTime(); | |
70 | now=then; | |
71 | while((now-then)<gap) { | |
72 | now=new Date().getTime(); | |
73 | } | |
74 | } | |
75 | ||
76 | function p_notify(msg) { | |
77 | ||
78 | var n = parent.document.getElementById("notify"); | |
79 | var nb = parent.document.getElementById("notify_body"); | |
80 | ||
81 | if (!n || !nb) return; | |
82 | ||
83 | if (msg == "") { | |
84 | nb.innerHTML = " "; | |
85 | // n.style.background = "#ffffff"; | |
86 | } else { | |
87 | nb.innerHTML = msg; | |
88 | // n.style.background = "#fffff0"; | |
89 | } | |
90 | } | |
91 | ||
92 | function notify(msg) { | |
93 | ||
94 | var n = document.getElementById("notify"); | |
95 | var nb = document.getElementById("notify_body"); | |
96 | ||
97 | if (!n || !nb) return; | |
98 | ||
99 | if (msg == "") { | |
100 | nb.innerHTML = " "; | |
101 | // n.style.background = "#ffffff"; | |
102 | } else { | |
103 | nb.innerHTML = msg; | |
104 | // n.style.background = "#fffff0"; | |
105 | } | |
106 | ||
107 | } | |
108 | ||
109 | function printLockingError() { | |
110 | notify("Please wait until operation finishes");} | |
111 | ||
112 | var seq = ""; | |
113 | ||
114 | function hotkey_handler(e) { | |
115 | ||
116 | var keycode; | |
117 | ||
118 | if (!hotkeys_enabled) return; | |
119 | ||
120 | if (window.event) { | |
121 | keycode = window.event.keyCode; | |
122 | } else if (e) { | |
123 | keycode = e.which; | |
124 | } | |
125 | ||
126 | if (keycode == 13 || keycode == 27) { | |
127 | seq = ""; | |
128 | } else { | |
129 | seq = seq + "" + keycode; | |
130 | } | |
131 | ||
132 | var piggie = document.getElementById("piggie"); | |
133 | ||
134 | if (piggie) { | |
135 | ||
136 | if (seq.match("807371717369")) { | |
137 | localPiggieFunction(true); | |
138 | } else { | |
139 | localPiggieFunction(false); | |
140 | } | |
141 | } | |
142 | ||
143 | if (typeof localHotkeyHandler != 'undefined') { | |
144 | try { | |
145 | localHotkeyHandler(keycode); | |
146 | } catch (e) { | |
147 | exception_error("hotkey_handler", e); | |
148 | } | |
149 | } | |
150 | ||
151 | } | |
152 | ||
153 | function cleanSelectedList(element) { | |
154 | var content = document.getElementById(element); | |
155 | ||
156 | if (!document.getElementById("feedCatHolder")) { | |
157 | for (i = 0; i < content.childNodes.length; i++) { | |
158 | var child = content.childNodes[i]; | |
159 | child.className = child.className.replace("Selected", ""); | |
160 | } | |
161 | } else { | |
162 | for (i = 0; i < content.childNodes.length; i++) { | |
163 | var child = content.childNodes[i]; | |
164 | ||
165 | if (child.id == "feedCatHolder") { | |
166 | var fcat = child.lastChild; | |
167 | for (j = 0; j < fcat.childNodes.length; j++) { | |
168 | var feed = fcat.childNodes[j]; | |
169 | feed.className = feed.className.replace("Selected", ""); | |
170 | } | |
171 | } | |
172 | } | |
173 | ||
174 | } | |
175 | } | |
176 | ||
177 | ||
178 | function cleanSelected(element) { | |
179 | var content = document.getElementById(element); | |
180 | ||
181 | for (i = 0; i < content.rows.length; i++) { | |
182 | content.rows[i].className = content.rows[i].className.replace("Selected", ""); | |
183 | } | |
184 | ||
185 | } | |
186 | ||
187 | function getVisibleUnreadHeadlines() { | |
188 | var content = document.getElementById("headlinesList"); | |
189 | ||
190 | var rows = new Array(); | |
191 | ||
192 | for (i = 0; i < content.rows.length; i++) { | |
193 | var row_id = content.rows[i].id.replace("RROW-", ""); | |
194 | if (row_id.length > 0 && content.rows[i].className.match("Unread")) { | |
195 | rows.push(row_id); | |
196 | } | |
197 | } | |
198 | return rows; | |
199 | } | |
200 | ||
201 | function getVisibleHeadlineIds() { | |
202 | ||
203 | var content = document.getElementById("headlinesList"); | |
204 | ||
205 | var rows = new Array(); | |
206 | ||
207 | for (i = 0; i < content.rows.length; i++) { | |
208 | var row_id = content.rows[i].id.replace("RROW-", ""); | |
209 | if (row_id.length > 0) { | |
210 | rows.push(row_id); | |
211 | } | |
212 | } | |
213 | return rows; | |
214 | } | |
215 | ||
216 | function getFirstVisibleHeadlineId() { | |
217 | var rows = getVisibleHeadlineIds(); | |
218 | return rows[0]; | |
219 | } | |
220 | ||
221 | function getLastVisibleHeadlineId() { | |
222 | var rows = getVisibleHeadlineIds(); | |
223 | return rows[rows.length-1]; | |
224 | } | |
225 | ||
226 | function markHeadline(id) { | |
227 | var row = document.getElementById("RROW-" + id); | |
228 | if (row) { | |
229 | var is_active = false; | |
230 | ||
231 | if (row.className.match("Active")) { | |
232 | is_active = true; | |
233 | } | |
234 | row.className = row.className.replace("Selected", ""); | |
235 | row.className = row.className.replace("Active", ""); | |
236 | row.className = row.className.replace("Insensitive", ""); | |
237 | ||
238 | if (is_active) { | |
239 | row.className = row.className = "Active"; | |
240 | } | |
241 | ||
242 | row.className = row.className + "Selected"; | |
243 | ||
244 | } | |
245 | } | |
246 | ||
247 | function getFeedIds() { | |
248 | var content = document.getElementById("feedsList"); | |
249 | ||
250 | var rows = new Array(); | |
251 | ||
252 | for (i = 0; i < content.rows.length; i++) { | |
253 | var id = content.rows[i].id.replace("FEEDR-", ""); | |
254 | if (id.length > 0) { | |
255 | rows.push(id); | |
256 | } | |
257 | } | |
258 | ||
259 | return rows; | |
260 | } | |
261 | ||
262 | function setCookie(name, value, expires, path, domain, secure) { | |
263 | document.cookie= name + "=" + escape(value) + | |
264 | ((expires) ? "; expires=" + expires.toGMTString() : "") + | |
265 | ((path) ? "; path=" + path : "") + | |
266 | ((domain) ? "; domain=" + domain : "") + | |
267 | ((secure) ? "; secure" : ""); | |
268 | } | |
269 | ||
270 | function getCookie(name) { | |
271 | ||
272 | var dc = document.cookie; | |
273 | var prefix = name + "="; | |
274 | var begin = dc.indexOf("; " + prefix); | |
275 | if (begin == -1) { | |
276 | begin = dc.indexOf(prefix); | |
277 | if (begin != 0) return null; | |
278 | } | |
279 | else { | |
280 | begin += 2; | |
281 | } | |
282 | var end = document.cookie.indexOf(";", begin); | |
283 | if (end == -1) { | |
284 | end = dc.length; | |
285 | } | |
286 | return unescape(dc.substring(begin + prefix.length, end)); | |
287 | } | |
288 | ||
289 | function disableContainerChildren(id, disable, doc) { | |
290 | ||
291 | if (!doc) doc = document; | |
292 | ||
293 | var container = doc.getElementById(id); | |
294 | ||
295 | for (var i = 0; i < container.childNodes.length; i++) { | |
296 | var child = container.childNodes[i]; | |
297 | ||
298 | try { | |
299 | child.disabled = disable; | |
300 | } catch (E) { | |
301 | ||
302 | } | |
303 | ||
304 | if (disable) { | |
305 | if (child.className && child.className.match("button")) { | |
306 | child.className = "disabledButton"; | |
307 | } | |
308 | } else { | |
309 | if (child.className && child.className.match("disabledButton")) { | |
310 | child.className = "button"; | |
311 | } | |
312 | } | |
313 | } | |
314 | ||
315 | } | |
316 | ||
317 | function gotoPreferences() { | |
318 | document.location.href = "prefs.php"; | |
319 | } | |
320 | ||
321 | function gotoMain() { | |
322 | document.location.href = "tt-rss.php"; | |
323 | } | |
324 | ||
325 | function gotoExportOpml() { | |
326 | document.location.href = "opml.php?op=Export"; | |
327 | } | |
328 | ||
329 | function getActiveFeedId() { | |
330 | return getCookie("ttrss_vf_actfeed"); | |
331 | } | |
332 | ||
333 | function setActiveFeedId(id) { | |
334 | return setCookie("ttrss_vf_actfeed", id); | |
335 | } | |
336 | ||
337 | var xmlhttp_rpc = false; | |
338 | ||
339 | /*@cc_on @*/ | |
340 | /*@if (@_jscript_version >= 5) | |
341 | // JScript gives us Conditional compilation, we can cope with old IE versions. | |
342 | // and security blocked creation of the objects. | |
343 | try { | |
344 | xmlhttp_rpc = new ActiveXObject("Msxml2.XMLHTTP"); | |
345 | } catch (e) { | |
346 | try { | |
347 | xmlhttp_rpc = new ActiveXObject("Microsoft.XMLHTTP"); | |
348 | } catch (E) { | |
349 | xmlhttp_rpc = false; | |
350 | } | |
351 | } | |
352 | @end @*/ | |
353 | ||
354 | if (!xmlhttp_rpc && typeof XMLHttpRequest!='undefined') { | |
355 | xmlhttp_rpc = new XMLHttpRequest(); | |
356 | } | |
357 | ||
358 | function parse_counters(reply, f_document, title_obj) { | |
359 | try { | |
360 | for (var l = 0; l < reply.childNodes.length; l++) { | |
361 | if (!reply.childNodes[l] || | |
362 | typeof(reply.childNodes[l].getAttribute) == "undefined") { | |
363 | // where did this come from? | |
364 | continue; | |
365 | } | |
366 | ||
367 | var id = reply.childNodes[l].getAttribute("id"); | |
368 | var t = reply.childNodes[l].getAttribute("type"); | |
369 | var ctr = reply.childNodes[l].getAttribute("counter"); | |
370 | var error = reply.childNodes[l].getAttribute("error"); | |
371 | var has_img = reply.childNodes[l].getAttribute("hi"); | |
372 | ||
373 | if (id == "global-unread") { | |
374 | title_obj.global_unread = ctr; | |
375 | title_obj.updateTitle(); | |
376 | continue; | |
377 | } | |
378 | ||
379 | if (t == "category") { | |
380 | var catctr = f_document.getElementById("FCATCTR-" + id); | |
381 | if (catctr) { | |
382 | catctr.innerHTML = "(" + ctr + " unread)"; | |
383 | } | |
384 | continue; | |
385 | } | |
386 | ||
387 | var feedctr = f_document.getElementById("FEEDCTR-" + id); | |
388 | var feedu = f_document.getElementById("FEEDU-" + id); | |
389 | var feedr = f_document.getElementById("FEEDR-" + id); | |
390 | var feed_img = f_document.getElementById("FIMG-" + id); | |
391 | ||
392 | if (feedctr && feedu && feedr) { | |
393 | ||
394 | feedu.innerHTML = ctr; | |
395 | ||
396 | if (error) { | |
397 | feedr.className = feedr.className.replace("feed", "error"); | |
398 | } else if (id > 0) { | |
399 | feedr.className = feedr.className.replace("error", "feed"); | |
400 | } | |
401 | ||
402 | if (ctr > 0) { | |
403 | feedctr.className = "odd"; | |
404 | if (!feedr.className.match("Unread")) { | |
405 | var is_selected = feedr.className.match("Selected"); | |
406 | ||
407 | feedr.className = feedr.className.replace("Selected", ""); | |
408 | feedr.className = feedr.className.replace("Unread", ""); | |
409 | ||
410 | feedr.className = feedr.className + "Unread"; | |
411 | ||
412 | if (is_selected) { | |
413 | feedr.className = feedr.className + "Selected"; | |
414 | } | |
415 | ||
416 | } | |
417 | } else { | |
418 | feedctr.className = "invisible"; | |
419 | feedr.className = feedr.className.replace("Unread", ""); | |
420 | } | |
421 | } | |
422 | } | |
423 | } catch (e) { | |
424 | exception_error("parse_counters", e); | |
425 | } | |
426 | } | |
427 | ||
428 | // this one is called from feedlist context | |
429 | // thus title_obj passed to parse_counters is parent (e.g. main ttrss window) | |
430 | ||
431 | function all_counters_callback() { | |
432 | if (xmlhttp_rpc.readyState == 4) { | |
433 | try { | |
434 | if (!xmlhttp_rpc.responseXML || !xmlhttp_rpc.responseXML.firstChild) { | |
435 | notify("[all_counters_callback] backend did not return valid XML"); | |
436 | return; | |
437 | } | |
438 | ||
439 | var reply = xmlhttp_rpc.responseXML.firstChild; | |
440 | var f_document = parent.frames["feeds-frame"].document; | |
441 | ||
442 | parse_counters(reply, f_document, parent); | |
443 | ||
444 | } catch (e) { | |
445 | exception_error("all_counters_callback", e); | |
446 | } | |
447 | } | |
448 | } | |
449 | ||
450 | function update_all_counters(feed) { | |
451 | if (xmlhttp_ready(xmlhttp_rpc)) { | |
452 | var query = "backend.php?op=rpc&subop=getAllCounters"; | |
453 | ||
454 | if (feed > 0) { | |
455 | query = query + "&aid=" + feed; | |
456 | } | |
457 | ||
458 | xmlhttp_rpc.open("GET", query, true); | |
459 | xmlhttp_rpc.onreadystatechange=all_counters_callback; | |
460 | xmlhttp_rpc.send(null); | |
461 | } | |
462 | } | |
463 | ||
464 | function popupHelp(tid) { | |
465 | var w = window.open("backend.php?op=help&tid=" + tid, | |
466 | "Popup Help", | |
467 | "menubar=no,location=no,resizable=yes,scrollbars=yes,status=no"); | |
468 | } | |
469 | ||
470 | /** * @(#)isNumeric.js * * Copyright (c) 2000 by Sundar Dorai-Raj | |
471 | * * @author Sundar Dorai-Raj | |
472 | * * Email: sdoraira@vt.edu | |
473 | * * This program is free software; you can redistribute it and/or | |
474 | * * modify it under the terms of the GNU General Public License | |
475 | * * as published by the Free Software Foundation; either version 2 | |
476 | * * of the License, or (at your option) any later version, | |
477 | * * provided that any use properly credits the author. | |
478 | * * This program is distributed in the hope that it will be useful, | |
479 | * * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
480 | * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
481 | * * GNU General Public License for more details at http://www.gnu.org * * */ | |
482 | ||
483 | var numbers=".0123456789"; | |
484 | function isNumeric(x) { | |
485 | // is x a String or a character? | |
486 | if(x.length>1) { | |
487 | // remove negative sign | |
488 | x=Math.abs(x)+""; | |
489 | for(j=0;j<x.length;j++) { | |
490 | // call isNumeric recursively for each character | |
491 | number=isNumeric(x.substring(j,j+1)); | |
492 | if(!number) return number; | |
493 | } | |
494 | return number; | |
495 | } | |
496 | else { | |
497 | // if x is number return true | |
498 | if(numbers.indexOf(x)>=0) return true; | |
499 | return false; | |
500 | } | |
501 | } | |
502 | ||
503 | ||
504 | function hideOrShowFeeds(doc, hide) { | |
505 | ||
506 | if (!doc.styleSheets) return; | |
507 | ||
508 | var css_rules = doc.styleSheets[0].cssRules; | |
509 | ||
510 | if (!css_rules || !css_rules.length) return; | |
511 | ||
512 | for (i = 0; i < css_rules.length; i++) { | |
513 | var rule = css_rules[i]; | |
514 | ||
515 | if (rule.selectorText == "ul.feedList li.feed") { | |
516 | if (!hide) { | |
517 | rule.style.display = "block"; | |
518 | } else { | |
519 | rule.style.display = "none"; | |
520 | } | |
521 | } | |
522 | ||
523 | } | |
524 | ||
525 | } | |
526 | ||
527 | function fatalError(code) { | |
528 | window.location = "error.php?c=" + param_escape(code); | |
529 | } | |
530 | ||
531 | function selectTableRow(r, do_select) { | |
532 | r.className = r.className.replace("Selected", ""); | |
533 | ||
534 | if (do_select) { | |
535 | r.className = r.className + "Selected"; | |
536 | } | |
537 | } | |
538 | ||
539 | function selectTableRowById(elem_id, check_id, do_select) { | |
540 | ||
541 | try { | |
542 | ||
543 | var row = document.getElementById(elem_id); | |
544 | ||
545 | if (row) { | |
546 | selectTableRow(row, do_select); | |
547 | } | |
548 | ||
549 | var check = document.getElementById(check_id); | |
550 | ||
551 | if (check) { | |
552 | check.checked = do_select; | |
553 | } | |
554 | } catch (e) { | |
555 | exception_error("selectTableRowById", e); | |
556 | } | |
557 | } | |
558 | ||
559 | function selectTableRowsByIdPrefix(content_id, prefix, check_prefix, do_select, | |
560 | classcheck, reset_others) { | |
561 | ||
562 | var content = document.getElementById(content_id); | |
563 | ||
564 | if (!content) { | |
565 | alert("[selectTableRows] Element " + content_id + " not found."); | |
566 | return; | |
567 | } | |
568 | ||
569 | for (i = 0; i < content.rows.length; i++) { | |
570 | if (!classcheck || content.rows[i].className.match(classcheck)) { | |
571 | ||
572 | if (content.rows[i].id.match(prefix)) { | |
573 | selectTableRow(content.rows[i], do_select); | |
574 | ||
575 | var row_id = content.rows[i].id.replace(prefix, ""); | |
576 | var check = document.getElementById(check_prefix + row_id); | |
577 | ||
578 | if (check) { | |
579 | check.checked = do_select; | |
580 | } | |
581 | } else if (reset_others) { | |
582 | selectTableRow(content.rows[i], false); | |
583 | } | |
584 | } else if (reset_others) { | |
585 | selectTableRow(content.rows[i], false); | |
586 | } | |
587 | } | |
588 | } | |
589 | ||
590 | function getSelectedTableRowIds(content_id, prefix) { | |
591 | ||
592 | var content = document.getElementById(content_id); | |
593 | ||
594 | if (!content) { | |
595 | alert("[getSelectedTableRowIds] Element " + content_id + " not found."); | |
596 | return; | |
597 | } | |
598 | ||
599 | var sel_rows = new Array(); | |
600 | ||
601 | for (i = 0; i < content.rows.length; i++) { | |
602 | if (content.rows[i].id.match(prefix) && | |
603 | content.rows[i].className.match("Selected")) { | |
604 | ||
605 | var row_id = content.rows[i].id.replace(prefix + "-", ""); | |
606 | sel_rows.push(row_id); | |
607 | } | |
608 | } | |
609 | ||
610 | return sel_rows; | |
611 | ||
612 | } | |
613 | ||
614 | function toggleSelectRowById(sender, id) { | |
615 | var row = document.getElementById(id); | |
616 | ||
617 | if (sender.checked) { | |
618 | if (!row.className.match("Selected")) { | |
619 | row.className = row.className + "Selected"; | |
620 | } | |
621 | } else { | |
622 | if (row.className.match("Selected")) { | |
623 | row.className = row.className.replace("Selected", ""); | |
624 | } | |
625 | } | |
626 | } | |
627 | ||
628 | ||
629 | function toggleSelectRow(sender) { | |
630 | var parent_row = sender.parentNode.parentNode; | |
631 | ||
632 | if (sender.checked) { | |
633 | if (!parent_row.className.match("Selected")) { | |
634 | parent_row.className = parent_row.className + "Selected"; | |
635 | } | |
636 | } else { | |
637 | if (parent_row.className.match("Selected")) { | |
638 | parent_row.className = parent_row.className.replace("Selected", ""); | |
639 | } | |
640 | } | |
641 | } | |
642 | ||
643 | function openExternalUrl(url) { | |
644 | var w = window.open(url); | |
645 | } | |
646 | ||
647 | ||
648 | function getRelativeFeedId(list, id, direction) { | |
649 | if (!id) { | |
650 | if (direction == "next") { | |
651 | for (i = 0; i < list.childNodes.length; i++) { | |
652 | var child = list.childNodes[i]; | |
653 | if (child.id == "feedCatHolder") { | |
654 | if (child.lastChild) { | |
655 | var cr = getRelativeFeedId(child.firstChild, id, direction); | |
656 | if (cr) return cr; | |
657 | } | |
658 | } else if (child.id.match("FEEDR-")) { | |
659 | return child.id.replace('FEEDR-', ''); | |
660 | } | |
661 | } | |
662 | } | |
663 | ||
664 | // FIXME select last feed doesn't work when only unread feeds are visible | |
665 | ||
666 | if (direction == "prev") { | |
667 | for (i = list.childNodes.length-1; i >= 0; i--) { | |
668 | var child = list.childNodes[i]; | |
669 | if (child.id == "feedCatHolder") { | |
670 | if (child.firstChild) { | |
671 | var cr = getRelativeFeedId(child.firstChild, id, direction); | |
672 | if (cr) return cr; | |
673 | } | |
674 | } else if (child.id.match("FEEDR-")) { | |
675 | ||
676 | if (getCookie("ttrss_vf_hreadf") == 1) { | |
677 | if (child.className != "feed") { | |
678 | alert(child.className); | |
679 | return child.id.replace('FEEDR-', ''); | |
680 | } | |
681 | } else { | |
682 | return child.id.replace('FEEDR-', ''); | |
683 | } | |
684 | } | |
685 | } | |
686 | } | |
687 | } else { | |
688 | ||
689 | var feed = list.ownerDocument.getElementById("FEEDR-" + getActiveFeedId()); | |
690 | ||
691 | if (direction == "next") { | |
692 | ||
693 | if (feed.nextSibling) { | |
694 | ||
695 | var next_feed = feed.nextSibling; | |
696 | ||
697 | while (!next_feed.id && next_feed.nextSibling) { | |
698 | next_feed = next_feed.nextSibling; | |
699 | } | |
700 | ||
701 | if (getCookie("ttrss_vf_hreadf") == 1) { | |
702 | while (next_feed && next_feed.className == "feed") { | |
703 | next_feed = next_feed.nextSibling; | |
704 | } | |
705 | } | |
706 | ||
707 | if (next_feed && next_feed.id.match("FEEDR-")) { | |
708 | return next_feed.id.replace("FEEDR-", ""); | |
709 | } | |
710 | } | |
711 | ||
712 | var this_cat = feed.parentNode.parentNode; | |
713 | ||
714 | if (this_cat && this_cat.nextSibling) { | |
715 | while (this_cat = this_cat.nextSibling) { | |
716 | if (this_cat.firstChild && this_cat.firstChild.firstChild) { | |
717 | var next_feed = this_cat.firstChild.firstChild; | |
718 | if (getCookie("ttrss_vf_hreadf") == 1) { | |
719 | while (next_feed && next_feed.className == "feed") { | |
720 | next_feed = next_feed.nextSibling; | |
721 | } | |
722 | } | |
723 | if (next_feed && next_feed.id.match("FEEDR-")) { | |
724 | return next_feed.id.replace("FEEDR-", ""); | |
725 | } | |
726 | } | |
727 | } | |
728 | } | |
729 | } else if (direction == "prev") { | |
730 | ||
731 | if (feed.previousSibling) { | |
732 | ||
733 | var prev_feed = feed.previousSibling; | |
734 | ||
735 | if (getCookie("ttrss_vf_hreadf") == 1) { | |
736 | while (prev_feed && prev_feed.className == "feed") { | |
737 | prev_feed = prev_feed.previousSibling; | |
738 | } | |
739 | } | |
740 | ||
741 | while (!prev_feed.id && prev_feed.previousSibling) { | |
742 | prev_feed = prev_feed.previousSibling; | |
743 | } | |
744 | ||
745 | if (prev_feed && prev_feed.id.match("FEEDR-")) { | |
746 | return prev_feed.id.replace("FEEDR-", ""); | |
747 | } | |
748 | } | |
749 | ||
750 | var this_cat = feed.parentNode.parentNode; | |
751 | ||
752 | if (this_cat && this_cat.previousSibling) { | |
753 | while (this_cat = this_cat.previousSibling) { | |
754 | if (this_cat.lastChild && this_cat.firstChild.lastChild) { | |
755 | var prev_feed = this_cat.firstChild.lastChild; | |
756 | if (getCookie("ttrss_vf_hreadf") == 1) { | |
757 | while (prev_feed && prev_feed.className == "feed") { | |
758 | prev_feed = prev_feed.previousSibling; | |
759 | } | |
760 | } | |
761 | if (prev_feed && prev_feed.id.match("FEEDR-")) { | |
762 | return prev_feed.id.replace("FEEDR-", ""); | |
763 | } | |
764 | } | |
765 | } | |
766 | } | |
767 | } | |
768 | } | |
769 | } | |
770 | ||
771 | function showBlockElement(id) { | |
772 | var elem = document.getElementById(id); | |
773 | ||
774 | if (elem) { | |
775 | elem.style.display = "block"; | |
776 | } else { | |
777 | alert("[showBlockElement] can't find element with id " + id); | |
778 | } | |
779 | } | |
780 | ||
781 | function hideParentElement(e) { | |
782 | e.parentNode.style.display = "none"; | |
783 | } | |
784 | ||
785 | function dropboxSelect(e, v) { | |
786 | for (i = 0; i < e.length; i++) { | |
787 | if (e[i].value == v) { | |
788 | e.selectedIndex = i; | |
789 | break; | |
790 | } | |
791 | } | |
792 | } |