diff -r 902822492a68 -r fe660c52c48f includes/clientside/static/sliders.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/includes/clientside/static/sliders.js Wed Jun 13 16:07:17 2007 -0400 @@ -0,0 +1,210 @@ +// Sliding drawers on the sidebar + +// our global vars +// the delay between the slide in/out, and a little inertia + +var sliders_initted = false; + +function initSliders() +{ + sliders_initted = true; + // detect whether the user has ie or not, how we get the height is different + var useragent = navigator.userAgent.toLowerCase(); + var ie = ((useragent.indexOf('msie') != -1) && (useragent.indexOf('opera') == -1) && (useragent.indexOf('webtv') == -1)); + + if(ie) + return; + + var divs = getElementsByClassName(document, "div", "slideblock"); + + for(var i=0; i targetheight) + { + // reduce the height by intertiabase * inertiainc + heightnow -= inertiabase; + + // increase the intertiabase by the amount to keep it changing + inertiabase += inertiainc; + + // it's possible to exceed the height we want so we use a ternary - (condition) ? when true : when false; + block.style.height = (heightnow > 1) ? heightnow + "px" : targetheight + "px"; + } + else + { + // finished, so hide the div properly and kill the interval + clearInterval(slideinterval); + block.style.display = "none"; + } +} + +// this is the function our slideout interval uses, it keeps adding +// to the height till it's fully displayed +function slideout() +{ + block.style.display = 'block'; + if(heightnow < targetheight) + { + // increases the height by the inertia stuff + heightnow += inertiabase; + + // increase the inertia stuff + inertiabase += inertiainc; + + // it's possible to exceed the height we want so we use a ternary - (condition) ? when true : when false; + block.style.height = (heightnow < targetheight) ? heightnow + "px" : targetheight + "px"; + + } + else + { + // finished, so make sure the height is what it's meant to be (inertia can make it off a little) + // then kill the interval + clearInterval(slideinterval); + block.style.height = targetheight + "px"; + } +} + +// returns the height of the div from our array of such things +function divheight(d) +{ + for(var i=0; i