resize_headlines: add exception handling

master
Andrew Dolgov 17 years ago
parent f74cfded6f
commit e8f7d7264c

@ -361,71 +361,77 @@ function init() {
function resize_headlines(delta_x, delta_y) { function resize_headlines(delta_x, delta_y) {
debug("resize_headlines: " + delta_x + ":" + delta_y); try {
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") {
if (delta_x != undefined) { debug("resize_headlines: " + delta_x + ":" + delta_y);
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; 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); if (getInitParam("theme") == "3pane") {
c_frame.style.width = (400 + hor_offset) + "px"; if (delta_x != undefined) {
h_frame.style.right = c_frame.offsetWidth - 1 + "px"; 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;
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: 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); } catch (e) {
exception_error("resize_headlines", e);
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);
} }
} }

Loading…
Cancel
Save