45 lines
1.5 KiB
JavaScript
45 lines
1.5 KiB
JavaScript
function get_window_size() {
|
|
if (window.innerHeight)
|
|
return [window.innerHeight, window.innerWidth];
|
|
else if (self.innerHeight)
|
|
return [self.innerHeight, self.innerWidth];
|
|
else if (document.documentElement && document.documentElement.clientHeight)
|
|
return [document.documentElement.clientHeight,
|
|
document.documentElement.clientWidth];
|
|
else if (document.body)
|
|
return [document.body.clientHeight, document.body.clientWidth];
|
|
}
|
|
|
|
function is_screen_media() {
|
|
return (document.getElementsByTagName('link')[0].getAttribute('media').indexOf(
|
|
'screen') != -1 || (document.styleSheets &&
|
|
(document.styleSheets[0].media.mediaText.indexOf(
|
|
'screen') != -1 || document.styleSheets[0].media.indexOf(
|
|
'screen') != -1)));
|
|
}
|
|
|
|
function set_min_height() {
|
|
if (!is_screen_media())
|
|
return;
|
|
var ws, wh, ww, h
|
|
ws = get_window_size()
|
|
wh = ws[0]
|
|
ww = ws[1]
|
|
|
|
h = metadiv.offsetHeight + 15
|
|
metadiv.style.position = 'absolute'
|
|
metadiv.style.bottom = '5px'
|
|
metadiv.style.width = (bodydiv.offsetWidth - 22) + 'px'
|
|
bodydiv.style.paddingBottom = h + 'px'
|
|
|
|
h = wh - h - menudiv.offsetHeight - 145
|
|
bodydiv.style.minHeight = h + 'px'
|
|
}
|
|
|
|
window.addEventListener('load', function(event){
|
|
menudiv = document.getElementById('menu');
|
|
bodydiv = document.getElementById('body');
|
|
metadiv = document.getElementById('metadata');
|
|
set_min_height();
|
|
}, false);
|