(function(c) { function o(e) { e = parseInt(e).toString(16); return e.length < 2 ? "0" + e : e } function v(e) { for(;e && e.nodeName.toLowerCase() != "html";e = e.parentNode) { var a = c.css(e, "backgroundColor"); if(a != "rgba(0, 0, 0, 0)") { if(a.indexOf("rgb") >= 0) { e = a.match(/\d+/g); return"#" + o(e[0]) + o(e[1]) + o(e[2]) } if(a && a != "transparent") { return a } } } return"#ffffff" } function w(e, a, b) { switch(e) { case "round": return Math.round(b * (1 - Math.cos(Math.asin(a / b)))); case "cool": return Math.round(b * (1 + Math.cos(Math.asin(a / b)))); case "sharp": return Math.round(b * (1 - Math.cos(Math.acos(a / b)))); case "bite": return Math.round(b * Math.cos(Math.asin((b - a - 1) / b))); case "slide": return Math.round(b * Math.atan2(a, b / a)); case "jut": return Math.round(b * Math.atan2(b, b - a - 1)); case "curl": return Math.round(b * Math.atan(a)); case "tear": return Math.round(b * Math.cos(a)); case "wicked": return Math.round(b * Math.tan(a)); case "long": return Math.round(b * Math.sqrt(a)); case "sculpt": return Math.round(b * Math.log(b - a - 1, b)); case "dog": return a & 1 ? a + 1 : b; case "dog2": return a & 2 ? a + 1 : b; case "dog3": return a & 3 ? a + 1 : b; case "fray": return a % 2 * b; case "notch": return b; case "bevel": return a + 1 } } var k = c.browser.mozilla && /gecko/i.test(navigator.userAgent), r = c.browser.safari && c.browser.version >= 3, s = c.browser.msie && function() { var e = document.createElement("div"); try { e.style.setExpression("width", "0+0") }catch(a) { return false } return true }(); c.fn.corner = function(e) { if(this.length == 0) { if(!c.isReady && this.selector) { var a = this.selector, b = this.context; c(function() { c(a, b).corner(e) }) } return this } return this.each(function() { var g = c(this), d = (e || g.attr(c.fn.corner.defaults.metaAttr) || "").toLowerCase(), p = /keep/.test(d), i = (d.match(/cc:(#[0-9a-f]+)/) || [])[1], h = (d.match(/sc:(#[0-9a-f]+)/) || [])[1], j = parseInt((d.match(/(\d+)px/) || [])[1]) || 10, t = (d.match(/round|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dog/) || ["round"])[0], u = {T:0, B:1}; d = {TL:/top|tl|left/.test(d), TR:/top|tr|right/.test(d), BL:/bottom|bl|left/.test(d), BR:/bottom|br|right/.test(d)}; if(!d.TL && !d.TR && !d.BL && !d.BR) { d = {TL:1, TR:1, BL:1, BR:1} } if(c.fn.corner.defaults.useNative && t == "round" && (k || r) && !i && !h) { if(d.TL) { g.css(k ? "-moz-border-radius-topleft" : "-webkit-border-top-left-radius", j + "px") } if(d.TR) { g.css(k ? "-moz-border-radius-topright" : "-webkit-border-top-right-radius", j + "px") } if(d.BL) { g.css(k ? "-moz-border-radius-bottomleft" : "-webkit-border-bottom-left-radius", j + "px") } if(d.BR) { g.css(k ? "-moz-border-radius-bottomright" : "-webkit-border-bottom-right-radius", j + "px") } }else { g = document.createElement("div"); g.style.overflow = "hidden"; g.style.height = "1px"; g.style.backgroundColor = h || "transparent"; g.style.borderStyle = "solid"; h = {T:parseInt(c.css(this, "paddingTop")) || 0, R:parseInt(c.css(this, "paddingRight")) || 0, B:parseInt(c.css(this, "paddingBottom")) || 0, L:parseInt(c.css(this, "paddingLeft")) || 0}; if(typeof this.style.zoom != undefined) { this.style.zoom = 1 } if(!p) { this.style.border = "none" } g.style.borderColor = i || v(this.parentNode); p = c.curCSS(this, "height"); for(var m in u) { if((i = u[m]) && (d.BL || d.BR) || !i && (d.TL || d.TR)) { g.style.borderStyle = "none " + (d[m + "R"] ? "solid" : "none") + " none " + (d[m + "L"] ? "solid" : "none"); var l = document.createElement("div"); c(l).addClass("jquery-corner"); var f = l.style; i ? this.appendChild(l) : this.insertBefore(l, this.firstChild); if(i && p != "auto") { if(c.css(this, "position") == "static") { this.style.position = "relative" } f.position = "absolute"; f.bottom = f.left = f.padding = f.margin = "0"; if(s) { f.setExpression("width", "this.parentNode.offsetWidth") }else { f.width = "100%" } }else { if(!i && c.browser.msie) { if(c.css(this, "position") == "static") { this.style.position = "relative" } f.position = c.browser.version < "8.0" ? "relative" : "absolute"; f.top = f.left = f.right = f.padding = f.margin = "0"; if(s) { var n = (parseInt(c.css(this, "borderLeftWidth")) || 0) + (parseInt(c.css(this, "borderRightWidth")) || 0); f.setExpression("width", "this.parentNode.offsetWidth - " + n + '+ "px"') }else { f.width = "100%" } }else { f.position = "relative"; f.margin = !i ? "-" + h.T + "px -" + h.R + "px " + (h.T - j) + "px -" + h.L + "px" : h.B - j + "px -" + h.R + "px -" + h.B + "px -" + h.L + "px" } } for(f = 0;f < j;f++) { n = Math.max(0, w(t, f, j)); var q = g.cloneNode(false); q.style.borderWidth = "0 " + (d[m + "R"] ? n : 0) + "px 0 " + (d[m + "L"] ? n : 0) + "px"; i ? l.appendChild(q) : l.insertBefore(q, l.firstChild) } } } } }) }; c.fn.uncorner = function() { if(k || r) { this.css(k ? "-moz-border-radius" : "-webkit-border-radius", 0) } c("div.jquery-corner", this).remove(); return this }; c.fn.corner.defaults = {useNative:true, metaAttr:"data-corner"} })(jQuery);
