includes/clientside/static/sliders.js
changeset 740 098e744df928
parent 582 a38876c0793c
child 753 33ae51d7c685
equal deleted inserted replaced
739:dd13aa042f34 740:098e744df928
   175             return divheights[i].ht;
   175             return divheights[i].ht;
   176         }
   176         }
   177     }
   177     }
   178 }
   178 }
   179 
   179 
   180 /*
       
   181     the getElementsByClassName function I pilfered from this guy.  It's
       
   182     a useful function that'll return any/all tags with a specific css class.
       
   183 
   180 
   184     Written by Jonathan Snook, http://www.snook.ca/jonathan
       
   185     Add-ons by Robert Nyman, http://www.robertnyman.com
       
   186     
       
   187     Modified to match all elements that match the class name plus an integer after the name
       
   188     This is used in Enano to allow sliding sidebar widgets that use their own CSS
       
   189 */
       
   190 function getElementsByClassName(oElm, strTagName, strClassName)
       
   191 {
       
   192     // first it gets all of the specified tags
       
   193     var arrElements = (strTagName == "*" && document.all) ? document.all : oElm.getElementsByTagName(strTagName);
       
   194     
       
   195     // then it sets up an array that'll hold the results
       
   196     var arrReturnElements = new Array();
       
   197 
       
   198     // some regex stuff you don't need to worry about
       
   199     strClassName = strClassName.replace(/\-/g, "\\-");
       
   200 
       
   201     var oRegExp = new RegExp("(^|\\s)" + strClassName + "([0-9]*)(\\s|$)");
       
   202     var oElement;
       
   203     
       
   204     // now it iterates through the elements it grabbed above
       
   205     for(var i=0; i<arrElements.length; i++)
       
   206     {
       
   207         oElement = arrElements[i];
       
   208 
       
   209         // if the class matches what we're looking for it ads to the results array
       
   210         if(oElement.className.match(oRegExp))
       
   211         {
       
   212             arrReturnElements.push(oElement);
       
   213         }
       
   214     }
       
   215 
       
   216     // then it kicks the results back to us
       
   217     return (arrReturnElements)
       
   218 }
       
   219