diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/functions.js | 45 | ||||
-rw-r--r-- | js/tt-rss.js | 66 | ||||
-rw-r--r-- | js/viewfeed.js | 15 |
3 files changed, 58 insertions, 68 deletions
diff --git a/js/functions.js b/js/functions.js index 9915e6808..98a531851 100644 --- a/js/functions.js +++ b/js/functions.js @@ -182,11 +182,6 @@ function param_unescape(arg) { return unescape(arg); } - -function hide_notify() { - Element.hide('notify'); -} - function notify_real(msg, no_hide, n_type) { var n = $("notify"); @@ -198,13 +193,11 @@ function notify_real(msg, no_hide, n_type) { } if (msg == "") { - if (Element.visible(n)) { - notify_hide_timerid = window.setTimeout("hide_notify()", 0); + if (n.hasClassName("visible")) { + notify_hide_timerid = window.setTimeout(function() { + n.removeClassName("visible") }, 0); } return; - } else { - Element.show(n); - new Effect.Highlight(n); } /* types: @@ -218,30 +211,40 @@ function notify_real(msg, no_hide, n_type) { msg = "<span class=\"msg\"> " + __(msg) + "</span>"; - if (n_type == 1) { - n.className = "notify"; - } else if (n_type == 2) { - n.className = "notify progress"; + if (n_type == 2) { msg = "<span><img src='images/indicator_white.gif'></span>" + msg; no_hide = true; } else if (n_type == 3) { - n.className = "notify error"; msg = "<span><img src='images/alert.png'></span>" + msg; } else if (n_type == 4) { - n.className = "notify info"; msg = "<span><img src='images/information.png'></span>" + msg; } msg += " <span><img src=\"images/cross.png\" class=\"close\" title=\"" + __("Click to close") + "\" onclick=\"notify('')\"></span>"; -// msg = "<img src='images/live_com_loading.gif'> " + msg; - n.innerHTML = msg; - if (!no_hide) { - notify_hide_timerid = window.setTimeout("hide_notify()", 5*1000); - } + window.setTimeout(function() { + // goddamnit firefox + if (n_type == 2) { + n.className = "notify notify_progress visible"; + } else if (n_type == 3) { + n.className = "notify notify_error visible"; + msg = "<span><img src='images/alert.png'></span>" + msg; + } else if (n_type == 4) { + n.className = "notify notify_info visible"; + } else { + n.className = "notify visible"; + } + + if (!no_hide) { + notify_hide_timerid = window.setTimeout(function() { + n.removeClassName("visible") }, 5*1000); + } + + }, 10); + } function notify(msg, no_hide) { diff --git a/js/tt-rss.js b/js/tt-rss.js index c64145159..e79f47176 100644 --- a/js/tt-rss.js +++ b/js/tt-rss.js @@ -302,21 +302,27 @@ function init() { hotkey_actions["collapse_article"] = function() { var id = getActiveArticleId(); var elem = $("CICD-"+id); - if(elem.visible()) { - cdmCollapseArticle(null, id); - } - else { - cdmExpandArticle(id); + + if (elem) { + if (elem.visible()) { + cdmCollapseArticle(null, id); + } + else { + cdmExpandArticle(id); + } } }; hotkey_actions["toggle_expand"] = function() { var id = getActiveArticleId(); var elem = $("CICD-"+id); - if(elem.visible()) { - cdmCollapseArticle(null, id, false); - } - else { - cdmExpandArticle(id); + + if (elem) { + if (elem.visible()) { + cdmCollapseArticle(null, id, false); + } + else { + cdmExpandArticle(id); + } } }; hotkey_actions["search_dialog"] = function() { @@ -750,15 +756,6 @@ function parse_runtime_info(data) { // console.log("RI: " + k + " => " + v); - if (k == "new_version_available") { - if (v == "1") { - Element.show(dijit.byId("newVersionIcon").domNode); - } else { - Element.hide(dijit.byId("newVersionIcon").domNode); - } - return; - } - if (k == "dep_ts" && parseInt(getInitParam("dep_ts")) > 0) { if (parseInt(getInitParam("dep_ts")) < parseInt(v) && getInitParam("reload_on_ts_change")) { window.location.reload(); @@ -770,6 +767,16 @@ function parse_runtime_info(data) { return; } + if (k == "update_result") { + var updatesIcon = dijit.byId("updatesIcon").domNode; + + if (v) { + Element.show(updatesIcon); + } else { + Element.hide(updatesIcon); + } + } + if (k == "daemon_stamp_ok" && v != 1) { notify_error("<span onclick=\"javascript:explainError(3)\">Update daemon is not updating feeds.</span>", true); return; @@ -962,27 +969,6 @@ function reverseHeadlineOrder() { } } -function newVersionDlg() { - try { - var query = "backend.php?op=dlg&method=newVersion"; - - if (dijit.byId("newVersionDlg")) - dijit.byId("newVersionDlg").destroyRecursive(); - - dialog = new dijit.Dialog({ - id: "newVersionDlg", - title: __("New version available!"), - style: "width: 600px", - href: query, - }); - - dialog.show(); - - } catch (e) { - exception_error("newVersionDlg", e); - } -} - function handle_rpc_json(transport, scheduled_call) { try { var reply = JSON.parse(transport.responseText); diff --git a/js/viewfeed.js b/js/viewfeed.js index c319a8ed0..f236e1f7c 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -56,7 +56,7 @@ function headlines_callback2(transport, offset, background, infscroll_req) { if (infscroll_req == false) { $("headlines-frame").scrollTop = 0; - Element.hide("floatingTitle"); + $("floatingTitle").style.visibility = "hidden"; $("floatingTitle").setAttribute("rowid", 0); $("floatingTitle").innerHTML = ""; } @@ -1532,7 +1532,7 @@ function cdmCollapseArticle(event, id, unmark) { if (row.offsetTop < $("headlines-frame").scrollTop) scrollToRowId(row.id); - Element.hide("floatingTitle"); + $("floatingTitle").style.visibility = "hidden"; $("floatingTitle").setAttribute("rowid", false); } @@ -2357,7 +2357,7 @@ function scrollToRowId(id) { var row = $(id); if (row) - $("headlines-frame").scrollTop = row.offsetTop; + $("headlines-frame").scrollTop = row.offsetTop - 4; } catch (e) { exception_error("scrollToRowId", e); @@ -2402,11 +2402,12 @@ function updateFloatingTitle(unread_only) { PluginHost.run(PluginHost.HOOK_FLOATING_TITLE, child); } - if (child.offsetTop < hf.scrollTop - header.offsetHeight && - child.offsetTop + child.offsetHeight - hf.scrollTop > header.offsetHeight) - Element.show("floatingTitle"); + $("floatingTitle").style.marginRight = hf.offsetWidth - child.offsetWidth + "px"; + if (header.offsetTop + header.offsetHeight < hf.scrollTop + $("floatingTitle").offsetHeight - 5 && + child.offsetTop + child.offsetHeight >= hf.scrollTop + $("floatingTitle").offsetHeight - 5) + $("floatingTitle").style.visibility = "visible"; else - Element.hide("floatingTitle"); + $("floatingTitle").style.visibility = "hidden"; return; |