diff options
Diffstat (limited to 'lifespan.php')
| -rw-r--r-- | lifespan.php | 175 |
1 files changed, 87 insertions, 88 deletions
diff --git a/lifespan.php b/lifespan.php index c2efb9468b..642122cbe2 100644 --- a/lifespan.php +++ b/lifespan.php @@ -26,112 +26,111 @@ define('WT_SCRIPT_NAME', 'lifespan.php'); require './includes/session.php'; -$controller=new WT_Controller_Lifespan(); +$controller = new WT_Controller_Lifespan(); $controller ->pageHeader() ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js') ->addInlineJavascript('autocomplete();') ->addInlineJavascript(' - var timer; - var offSetNum = 20; // amount timeline moves with each mouse click - var speed; + var timer; + var offSetNum = 20; // amount timeline moves with each mouse click + var speed; - // method for scrolling timeline around in portal. takes in a string for the direction the timeline is moving "Left" "Right" "Top" "Down" - function startScroll(move) { - speed = parseInt(document.buttons.speedMenu.options[document.buttons.speedMenu.selectedIndex].value) * 25; //Sets the speed of the scroll feature - timer = 1; - scroll(move); + // method for scrolling timeline around in portal. takes in a string for the direction the timeline is moving "Left" "Right" "Top" "Down" + function startScroll(move) { + speed = parseInt(document.buttons.speedMenu.options[document.buttons.speedMenu.selectedIndex].value) * 25; //Sets the speed of the scroll feature + timer = 1; + scroll(move); + } + function scroll(move) { + if (timer==null) return; // If timer is not set timeline doesn\'t scroll + timer = setTimeout("scroll(\'"+move+"\')",speed); // Keeps the timeline moving as long as the user holds down the mouse button on one of the direction arrows + topInnerDiv = document.getElementById("topInner"); + innerDiv = document.getElementById("inner"); + myouterDiv = document.getElementById("lifespan_chart"); + //compares the direction the timeline is moving and how far it can move in each direction. + if (move == "left" && ((maxX+topInnerDiv.offsetLeft+350) > (myouterDiv.offsetLeft+myouterDiv.offsetWidth))) { + left = (innerDiv.offsetLeft - offSetNum)+"px"; + innerDiv.style.left = left; + topInnerDiv.style.left = left; } - function scroll(move) { - if (timer==null) return; // If timer is not set timeline doesn\'t scroll - timer = setTimeout("scroll(\'"+move+"\')",speed); // Keeps the timeline moving as long as the user holds down the mouse button on one of the direction arrows - topInnerDiv = document.getElementById("topInner"); - innerDiv = document.getElementById("inner"); - myouterDiv = document.getElementById("lifespan_chart"); - //compares the direction the timeline is moving and how far it can move in each direction. - if (move == "left" && ((maxX+topInnerDiv.offsetLeft+350) > (myouterDiv.offsetLeft+myouterDiv.offsetWidth))) { - left = (innerDiv.offsetLeft - offSetNum)+"px"; - innerDiv.style.left = left; - topInnerDiv.style.left = left; - } - else if (move == "right" && topInnerDiv.offsetLeft < (-10)) { - right = (innerDiv.offsetLeft + offSetNum)+"px"; - innerDiv.style.left = right; - topInnerDiv.style.left = right; - } - else if (move == "up" && innerDiv.offsetTop > maxY) { - up = (innerDiv.offsetTop - offSetNum)+"px"; - innerDiv.style.top = up; - } - else if (move == "down" && innerDiv.offsetTop < -60) { - down = (innerDiv.offsetTop + offSetNum)+"px"; - innerDiv.style.top = down; - } + else if (move == "right" && topInnerDiv.offsetLeft < (-10)) { + right = (innerDiv.offsetLeft + offSetNum)+"px"; + innerDiv.style.left = right; + topInnerDiv.style.left = right; } - - //method used to stop scrolling - function stopScroll() { - if (timer) clearTimeout(timer); - timer=null; - } - - var oldMx = 0; - var oldMy = 0; - var movei1 = ""; - var movei2 = ""; - function pandiv() { - if (movei1=="") { - oldMx = msX; - oldMy = msY; - } - i = document.getElementById("topInner"); - //alert(i.style.top); - movei1 = i; - i = document.getElementById("inner"); - movei2 = i; - return false; + else if (move == "up" && innerDiv.offsetTop > maxY) { + up = (innerDiv.offsetTop - offSetNum)+"px"; + innerDiv.style.top = up; } - function releaseimage() { - movei1 = ""; - movei2 = ""; - return true; + else if (move == "down" && innerDiv.offsetTop < -60) { + down = (innerDiv.offsetTop + offSetNum)+"px"; + innerDiv.style.top = down; } - // Main function to retrieve mouse x-y pos.s - function getMouseXY(e) { - var event = e || window.event; - if (typeof event.pageX === "undefined" || typeof event.pageY === "undefined") { - msX = event.clientX + document.documentElement.scrollLeft; - msY = event.clientY + document.documentElement.scrollTop; - } else { - msX = e.pageX; - msY = e.pageY; - } - // catch possible negative values in NS4 - if (msX < 0) {msX = 0;} - if (msY < 0) {msY = 0;} - if (movei1!="") { - //ileft = parseInt(movei1.style.left); - //itop = parseInt(movei2.style.top); - var ileft = movei2.offsetLeft+1; - var itop = movei2.offsetTop+1; - ileft = ileft - (oldMx-msX); - itop = itop - (oldMy-msY); - movei1.style.left = ileft+"px"; - movei2.style.left = ileft+"px"; - movei2.style.top = itop+"px"; + } + + //method used to stop scrolling + function stopScroll() { + if (timer) clearTimeout(timer); + timer=null; + } + + var oldMx = 0; + var oldMy = 0; + var movei1 = ""; + var movei2 = ""; + function pandiv() { + if (movei1=="") { oldMx = msX; oldMy = msY; - return false; - } } + i = document.getElementById("topInner"); + //alert(i.style.top); + movei1 = i; + i = document.getElementById("inner"); + movei2 = i; + return false; + } + function releaseimage() { + movei1 = ""; + movei2 = ""; + return true; + } + // Main function to retrieve mouse x-y pos.s + function getMouseXY(e) { + var event = e || window.event; + if (typeof event.pageX === "undefined" || typeof event.pageY === "undefined") { + msX = event.clientX + document.documentElement.scrollLeft; + msY = event.clientY + document.documentElement.scrollTop; + } else { + msX = e.pageX; + msY = e.pageY; + } + // catch possible negative values in NS4 + if (msX < 0) {msX = 0;} + if (msY < 0) {msY = 0;} + if (movei1!="") { + //ileft = parseInt(movei1.style.left); + //itop = parseInt(movei2.style.top); + var ileft = movei2.offsetLeft+1; + var itop = movei2.offsetTop+1; + ileft = ileft - (oldMx-msX); + itop = itop - (oldMy-msY); + movei1.style.left = ileft+"px"; + movei2.style.left = ileft+"px"; + movei2.style.top = itop+"px"; + oldMx = msX; + oldMy = msY; + return false; + } + } - document.onmousemove = getMouseXY; - document.onmouseup = releaseimage; + document.onmousemove = getMouseXY; + document.onmouseup = releaseimage; '); $people = count($controller->people); - ?> <div id="lifespan-page"> <h2><?php echo WT_I18N::translate('Lifespans'), help_link('lifespan_chart'); ?></h2> |
