From: Andrew Dolgov Date: Tue, 20 May 2008 10:41:00 +0000 (+0100) Subject: resize_headlines: add exception handling X-Git-Tag: 1.2.23-final~16 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=e8f7d7264c887050b5ce632aa706778818ae3c9f;p=tt-rss.git resize_headlines: add exception handling --- diff --git a/tt-rss.js b/tt-rss.js index d27a94af..c29d74de 100644 --- a/tt-rss.js +++ b/tt-rss.js @@ -361,71 +361,77 @@ function init() { function resize_headlines(delta_x, delta_y) { - debug("resize_headlines: " + delta_x + ":" + delta_y); - - var h_frame = document.getElementById("headlines-frame"); - var c_frame = document.getElementById("content-frame"); - var f_frame = document.getElementById("footer"); - var feeds_frame = document.getElementById("feeds-holder"); - var resize_grab = document.getElementById("resize-grabber"); - - if (!c_frame || !h_frame) return; - - if (feeds_frame && getInitParam("theme") == "compat") { - feeds_frame.style.bottom = f_frame.offsetHeight + "px"; - } - - if (getInitParam("theme") == "3pane") { + try { - if (delta_x != undefined) { - if (c_frame.offsetLeft - delta_x > feeds_frame.offsetWidth + feeds_frame.offsetLeft + 100 && c_frame.offsetWidth + delta_x > 100) { - hor_offset = hor_offset + delta_x; - } + debug("resize_headlines: " + delta_x + ":" + delta_y); + + var h_frame = document.getElementById("headlines-frame"); + var c_frame = document.getElementById("content-frame"); + var f_frame = document.getElementById("footer"); + var feeds_frame = document.getElementById("feeds-holder"); + var resize_grab = document.getElementById("resize-grabber"); + + if (!c_frame || !h_frame) return; + + if (feeds_frame && getInitParam("theme") == "compat") { + feeds_frame.style.bottom = f_frame.offsetHeight + "px"; } - - debug("resize_headlines: HOR-mode: " + hor_offset); - - c_frame.style.width = (400 + hor_offset) + "px"; - h_frame.style.right = c_frame.offsetWidth - 1 + "px"; - - resize_grab.style.top = (h_frame.offsetTop + h_frame.offsetHeight - 60) + "px"; - resize_grab.style.left = (h_frame.offsetLeft + h_frame.offsetWidth - - 4) + "px"; - resize_grab.style.display = "block"; - - } else { - - if (delta_y != undefined) { - if (c_frame.offsetHeight + delta_y > 100 && h_frame.offsetHeight - delta_y > 100) { - ver_offset = ver_offset + delta_y; + + if (getInitParam("theme") == "3pane") { + + if (delta_x != undefined) { + if (c_frame.offsetLeft - delta_x > feeds_frame.offsetWidth + feeds_frame.offsetLeft + 100 && c_frame.offsetWidth + delta_x > 100) { + hor_offset = hor_offset + delta_x; + } } + + debug("resize_headlines: HOR-mode: " + hor_offset); + + c_frame.style.width = (400 + hor_offset) + "px"; + h_frame.style.right = c_frame.offsetWidth - 1 + "px"; + + resize_grab.style.top = (h_frame.offsetTop + h_frame.offsetHeight - 60) + "px"; + resize_grab.style.left = (h_frame.offsetLeft + h_frame.offsetWidth - + 4) + "px"; + resize_grab.style.display = "block"; + + } else { + + if (delta_y != undefined) { + if (c_frame.offsetHeight + delta_y > 100 && h_frame.offsetHeight - delta_y > 100) { + ver_offset = ver_offset + delta_y; + } + } + + debug("resize_headlines: VER-mode: " + ver_offset); + + h_frame.style.height = (300 - ver_offset) + "px"; + + c_frame.style.top = (h_frame.offsetTop + h_frame.offsetHeight + 1) + "px"; + h_frame.style.height = h_frame.offsetHeight + "px"; + + var theme_c = 0; + + if (getInitParam("theme") == "graycube") theme_c = 1; + + resize_grab.style.top = (h_frame.offsetTop + h_frame.offsetHeight - + 4 - theme_c) + "px"; + resize_grab.style.display = "block"; + + } + + if (getInitParam("cookie_lifetime") != 0) { + setCookie("ttrss_offset_ver", ver_offset, + getInitParam("cookie_lifetime")); + setCookie("ttrss_offset_hor", hor_offset, + getInitParam("cookie_lifetime")); + } else { + setCookie("ttrss_offset_ver", ver_offset); + setCookie("ttrss_offset_hor", hor_offset); } - debug("resize_headlines: VER-mode: " + ver_offset); - - h_frame.style.height = (300 - ver_offset) + "px"; - - c_frame.style.top = (h_frame.offsetTop + h_frame.offsetHeight + 1) + "px"; - h_frame.style.height = h_frame.offsetHeight + "px"; - - var theme_c = 0; - - if (getInitParam("theme") == "graycube") theme_c = 1; - - resize_grab.style.top = (h_frame.offsetTop + h_frame.offsetHeight - - 4 - theme_c) + "px"; - resize_grab.style.display = "block"; - - } - - if (getInitParam("cookie_lifetime") != 0) { - setCookie("ttrss_offset_ver", ver_offset, - getInitParam("cookie_lifetime")); - setCookie("ttrss_offset_hor", hor_offset, - getInitParam("cookie_lifetime")); - } else { - setCookie("ttrss_offset_ver", ver_offset); - setCookie("ttrss_offset_hor", hor_offset); + } catch (e) { + exception_error("resize_headlines", e); } }