Minor cleanup

This commit is contained in:
Frederic Guillot 2013-07-10 22:33:23 -04:00
parent ac76db0052
commit a89d8c0005

View File

@ -275,14 +275,18 @@
if (item) switch_status(item.getAttribute("data-item-id")); if (item) switch_status(item.getAttribute("data-item-id"));
} }
function scroll_page_to(item) {
function scroll_page_to(item)
{
var clientHeight = pageYOffset + document.documentElement.clientHeight; var clientHeight = pageYOffset + document.documentElement.clientHeight;
var itemPosition = item.offsetTop + item.offsetHeight; var itemPosition = item.offsetTop + item.offsetHeight;
if (clientHeight - itemPosition < 0 || clientHeight - item.offsetTop > document.documentElement.clientHeight) { if (clientHeight - itemPosition < 0 || clientHeight - item.offsetTop > document.documentElement.clientHeight) {
scrollTo(0, item.offsetTop - 10); window.scrollTo(0, item.offsetTop - 10);
} }
} }
function set_links_item(item_id) function set_links_item(item_id)
{ {
var link = document.getElementById("current-item"); var link = document.getElementById("current-item");