diff options
Diffstat (limited to 'functions.js')
| -rw-r--r-- | functions.js | 61 |
1 files changed, 43 insertions, 18 deletions
diff --git a/functions.js b/functions.js index 2c09be16c..ff6075f11 100644 --- a/functions.js +++ b/functions.js @@ -18,6 +18,8 @@ function is_opera() { function exception_error(location, e, ext_info) { var msg = format_exception_error(location, e); + if (!ext_info) ext_info = "N/A"; + disableHotkeys(); try { @@ -578,6 +580,12 @@ function parse_counters(reply, scheduled_call) { debug("Subscribed feed number changed, refreshing feedlist"); setTimeout('updateFeedList(false, false)', 50); } + } else { +/* var fl = document.getElementById("feeds-frame").innerHTML; + if (fl) { + cache_invalidate("FEEDLIST"); + cache_inject("FEEDLIST", fl, getInitParam("num_feeds")); + } */ } } catch (e) { @@ -621,6 +629,8 @@ function parse_counters_reply(transport, scheduled_call) { function all_counters_callback2(transport, async_call) { try { if (async_call) async_counters_work = true; + + if (offline_mode) return; debug("<b>all_counters_callback2 IN: " + transport + "</b>"); parse_counters_reply(transport); @@ -848,25 +858,28 @@ function hideOrShowFeedsCategory(id, hide) { } // debug("end cat: " + node.id + " unread " + cat_unread); - - if (cat_unread == 0) { - if (cat_node.style == undefined) { - debug("ERROR: supplied cat_node " + cat_node + - " has no styles. WTF?"); - return; - } - if (hide) { - //cat_node.style.display = "none"; - Effect.Fade(cat_node, {duration : 0.3, - queue: { position: 'end', scope: 'CFADE-' + node.id, limit: 1 }}); + + if (cat_node) { + + if (cat_unread == 0) { + if (cat_node.style == undefined) { + debug("ERROR: supplied cat_node " + cat_node + + " has no styles. WTF?"); + return; + } + if (hide) { + //cat_node.style.display = "none"; + Effect.Fade(cat_node, {duration : 0.3, + queue: { position: 'end', scope: 'CFADE-' + node.id, limit: 1 }}); + } else { + cat_node.style.display = "list-item"; + } } else { - cat_node.style.display = "list-item"; - } - } else { - try { - cat_node.style.display = "list-item"; - } catch (e) { - debug(e); + try { + cat_node.style.display = "list-item"; + } catch (e) { + debug(e); + } } } @@ -1487,6 +1500,8 @@ function storeInitParam(key, value) { function fatalError(code, msg, ext_info) { try { + if (!ext_info) ext_info = "N/A"; + if (code == 6) { window.location.href = "tt-rss.php"; } else if (code == 5) { @@ -2103,3 +2118,13 @@ function transport_error_check(transport) { return true; } +function strip_tags(s) { + return s.replace(/<\/?[^>]+(>|$)/g, ""); +} + +function truncate_string(s, length) { + if (!length) length = 30; + var tmp = s.substring(0, length); + if (s.length > length) tmp += "…"; + return tmp; +} |