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