/** * Cornerz 0.4 - Bullet Proof Corners * Jonah Fox (jonah@parkerfox.co.uk) 2008 * * Usage: $('.myclass').curve(options) * options is a hash with the following parameters. Bracketed is the default * radius (10) * borderWidth (read from BorderTopWidth or 0) * background ("white"). Note that this is not calculated from the HTML as it is expensive * borderColor (read from BorderTopColor) * corners ("tl br tr bl"). Specify which borders */ ;(function($){ if($.browser.msie && document.namespaces["v"] == null) { document.namespaces.add("v", "urn:schemas-microsoft-com:vml"); var ss = document.createStyleSheet().owningElement; ss.styleSheet.cssText = "v\\:*{behavior:url(#default#VML);}" } $.fn.cornerz = function(options){ function canvasCorner(t,l, r,bw,bc,bg){ var sa,ea,cw,sx,sy,x,y, p = 1.57, css="position:absolute;" if(t) {sa=-p; sy=r; y=0; css+="top:-"+bw+"px;"; } else {sa=p; sy=0; y=r; css+="bottom:"+(-bw)+"px;"; } if(l) {ea=p*2; sx=r; x=0; css+="left:-"+bw+"px;"} else {ea=0; sx=0; x=r; css+="right:"+(-bw)+"px;"; } var canvas=$("") var ctx=canvas[0].getContext('2d') ctx.beginPath(); ctx.lineWidth=bw*2; ctx.arc(sx,sy,r,sa,ea,!(t^l)); ctx.strokeStyle=bc ctx.stroke() ctx.lineWidth = 0 ctx.lineTo(x,y) ctx.fillStyle=bg ctx.fill() return canvas } function canvasCorners(corners, r, bw,bc,bg,w,h,f) { var hh = $("
") // trying out style='float:left' $.each(corners.split(" "), function() { hh.append(canvasCorner(this[0]=="t",this[1]=="l", r,bw,bc,bg,w,h,f)) }) return hh } function vmlCurve(r,b,c,m,ml,mt, right_fix) { var l = m-ml-right_fix var t = m-mt return "