User:Alfa-R/vector.js
From Guild Wars 2 Wiki
Jump to navigationJump to search
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
hookEvent('load', setFooter);
hookEvent('resize', setFooter);
function getWindowHeight() {
if (self.innerHeight)
{
return self.innerHeight;
}
else if (document.documentElement && document.documentElement.clientHeight)
{
return document.documentElement.clientHeight;
}
else if (document.body)
{
return document.body.clientHeight;
}
}
function setFooter() {
var bh = document.body.offsetHeight;
var wh = getWindowHeight();
var p = document.getElementById("mw-panel");
var ph = p.offsetHeight + 160;
var f = document.getElementById("footer");
if (ph < bh) {
if (bh < wh) {
f.style.top = "auto";
f.style.position = "fixed";
}
else {
f.style.top = "0px";
f.style.position = "relative";
}
}
else
{
if (ph < wh) {
f.style.top = "auto";
f.style.position = "fixed";
}
else {
f.style.top = (ph - bh) + "px";
f.style.position = "relative";
}
}
}