From c38c2b69c9479817291ac06042fb5529b24f33f0 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 20 Mar 2006 12:24:34 +0100 Subject: [PATCH] center infobox on screen --- functions.js | 17 +++++++++++++++++ prefs.js | 6 +++--- tt-rss.css | 2 -- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/functions.js b/functions.js index 58ef1bfc7..92bcc3bf9 100644 --- a/functions.js +++ b/functions.js @@ -868,3 +868,20 @@ function leading_zero(p) { if (s.length == 1) s = "0" + s; return s; } + +function center_element(e) { + var c_width = document.body.clientWidth; + var c_height = document.body.clientHeight; + + var c_scroll = document.body.scrollTop; + + var e_width = e.clientWidth; + var e_height = e.clientHeight; + + var set_y = (c_height / 2) + c_scroll - (e_height / 2); + var set_x = (c_width / 2) - (e_width / 2); + + e.style.top = set_y + "px"; + e.style.left = set_x + "px"; + +} diff --git a/prefs.js b/prefs.js index 1d410fd60..1f74ae83d 100644 --- a/prefs.js +++ b/prefs.js @@ -149,11 +149,11 @@ function infobox_callback() { if (xmlhttp.readyState == 4) { var box = document.getElementById('infoBox'); var shadow = document.getElementById('infoBoxShadow'); - - if (box) { - box.innerHTML=xmlhttp.responseText; + if (box) { + box.innerHTML=xmlhttp.responseText; if (shadow) { shadow.style.display = "block"; + center_element(shadow); } else { box.style.display = "block"; } diff --git a/tt-rss.css b/tt-rss.css index 0e2a263f9..6c85c713c 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -554,11 +554,9 @@ div.helpResponse { #infoBoxShadow { background-image : url("images/shadow.png"); position : absolute; - margin-left : 30%; width : 30%; z-index : 3; display : none; - top : 30%; } div.infoBoxContents {