diff --git a/public/javascripts/handle_rounded_corners.js b/public/javascripts/handle_rounded_corners.js new file mode 100644 index 0000000..93c774e --- /dev/null +++ b/public/javascripts/handle_rounded_corners.js @@ -0,0 +1 @@ +Nifty('div.module'); diff --git a/public/javascripts/niftycube.js b/public/javascripts/niftycube.js new file mode 100755 index 0000000..e977660 --- /dev/null +++ b/public/javascripts/niftycube.js @@ -0,0 +1,298 @@ +/* Nifty Corners Cube - rounded corners with CSS and Javascript +Copyright 2006 Alessandro Fulciniti (a.fulciniti@html.it) + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +var niftyOk=(document.getElementById && document.createElement && Array.prototype.push); +var niftyCss=false; + +String.prototype.find=function(what){ +return(this.indexOf(what)>=0 ? true : false); +} + +var oldonload=window.onload; +if(typeof(NiftyLoad)!='function') NiftyLoad=function(){}; +if(typeof(oldonload)=='function') + window.onload=function(){oldonload();AddCss();NiftyLoad()}; +else window.onload=function(){AddCss();NiftyLoad()}; + +function AddCss(){ +niftyCss=true; +var l=CreateEl("link"); +l.setAttribute("type","text/css"); +l.setAttribute("rel","stylesheet"); +l.setAttribute("href","/stylesheets/niftyCorners.css"); +l.setAttribute("media","screen"); +document.getElementsByTagName("head")[0].appendChild(l); +} + +function Nifty(selector,options){ +if(niftyOk==false) return; +if(niftyCss==false) AddCss(); +var i,v=selector.split(","),h=0; +if(options==null) options=""; +if(options.find("fixed-height")) + h=getElementsBySelector(v[0])[0].offsetHeight; +for(i=0;i0;i--) + d.appendChild(CreateStrip(i,side,color,border,btype)); +el.style.paddingBottom=0; +el.appendChild(d); +} + +function CreateStrip(index,side,color,border,btype){ +var x=CreateEl("b"); +x.className=btype+index; +x.style.backgroundColor=color; +x.style.borderColor=border; +if(side=="left"){ + x.style.borderRightWidth="0"; + x.style.marginRight="0"; + } +else if(side=="right"){ + x.style.borderLeftWidth="0"; + x.style.marginLeft="0"; + } +return(x); +} + +function CreateEl(x){ +return(document.createElement(x)); +} + +function FixIE(el){ +if(el.currentStyle!=null && el.currentStyle.hasLayout!=null && el.currentStyle.hasLayout==false) + el.style.display="inline-block"; +} + +function SameHeight(selector,maxh){ +var i,v=selector.split(","),t,j,els=[],gap; +for(i=0;imaxh) maxh=els[i].offsetHeight; + els[i].style.height="auto"; + } +for(i=0;i0){ + t=CreateEl("b");t.className="niftyfill";t.style.height=gap+"px"; + nc=els[i].lastChild; + if(nc.className=="niftycorners") + els[i].insertBefore(t,nc); + else els[i].appendChild(t); + } + } +} + +function getElementsBySelector(selector){ +var i,j,selid="",selclass="",tag=selector,tag2="",v2,k,f,a,s=[],objlist=[],c; +if(selector.find("#")){ //id selector like "tag#id" + if(selector.find(" ")){ //descendant selector like "tag#id tag" + s=selector.split(" "); + var fs=s[0].split("#"); + if(fs.length==1) return(objlist); + f=document.getElementById(fs[1]); + if(f){ + v=f.getElementsByTagName(s[1]); + for(i=0;i