author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
Fri, 22 Mar 2013 20:10:19 +0100 | |
changeset 8773 | 21edcb0a5ed7 |
parent 7234 | 69aa3e68c231 |
permissions | -rw-r--r-- |
7234
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
1 |
/*! |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
2 |
* jQuery corner plugin: simple corner rounding |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
3 |
* Examples and documentation at: http://jquery.malsup.com/corner/ |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
4 |
* version 2.11 (15-JUN-2010) |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
5 |
* Requires jQuery v1.3.2 or later |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
6 |
* Dual licensed under the MIT and GPL licenses: |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
7 |
* http://www.opensource.org/licenses/mit-license.php |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
8 |
* http://www.gnu.org/licenses/gpl.html |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
9 |
* Authors: Dave Methvin and Mike Alsup |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
10 |
*/ |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
11 |
|
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
12 |
/** |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
13 |
* corner() takes a single string argument: $('#myDiv').corner("effect corners width") |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
14 |
* |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
15 |
* effect: name of the effect to apply, such as round, bevel, notch, bite, etc (default is round). |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
16 |
* corners: one or more of: top, bottom, tr, tl, br, or bl. (default is all corners) |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
17 |
* width: width of the effect; in the case of rounded corners this is the radius. |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
18 |
* specify this value using the px suffix such as 10px (yes, it must be pixels). |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
19 |
*/ |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
20 |
;(function($) { |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
21 |
|
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
22 |
var style = document.createElement('div').style, |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
23 |
moz = style['MozBorderRadius'] !== undefined, |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
24 |
webkit = style['WebkitBorderRadius'] !== undefined, |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
25 |
radius = style['borderRadius'] !== undefined || style['BorderRadius'] !== undefined, |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
26 |
mode = document.documentMode || 0, |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
27 |
noBottomFold = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8), |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
28 |
|
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
29 |
expr = $.browser.msie && (function() { |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
30 |
var div = document.createElement('div'); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
31 |
try { div.style.setExpression('width','0+0'); div.style.removeExpression('width'); } |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
32 |
catch(e) { return false; } |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
33 |
return true; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
34 |
})(); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
35 |
|
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
36 |
$.support = $.support || {}; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
37 |
$.support.borderRadius = moz || webkit || radius; // so you can do: if (!$.support.borderRadius) $('#myDiv').corner(); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
38 |
|
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
39 |
function sz(el, p) { |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
40 |
return parseInt($.css(el,p))||0; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
41 |
}; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
42 |
function hex2(s) { |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
43 |
var s = parseInt(s).toString(16); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
44 |
return ( s.length < 2 ) ? '0'+s : s; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
45 |
}; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
46 |
function gpc(node) { |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
47 |
while(node) { |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
48 |
var v = $.css(node,'backgroundColor'), rgb; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
49 |
if (v && v != 'transparent' && v != 'rgba(0, 0, 0, 0)') { |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
50 |
if (v.indexOf('rgb') >= 0) { |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
51 |
rgb = v.match(/\d+/g); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
52 |
return '#'+ hex2(rgb[0]) + hex2(rgb[1]) + hex2(rgb[2]); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
53 |
} |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
54 |
return v; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
55 |
} |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
56 |
if (node.nodeName.toLowerCase() == 'html') |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
57 |
break; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
58 |
node = node.parentNode; // keep walking if transparent |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
59 |
} |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
60 |
return '#ffffff'; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
61 |
}; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
62 |
|
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
63 |
function getWidth(fx, i, width) { |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
64 |
switch(fx) { |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
65 |
case 'round': return Math.round(width*(1-Math.cos(Math.asin(i/width)))); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
66 |
case 'cool': return Math.round(width*(1+Math.cos(Math.asin(i/width)))); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
67 |
case 'sharp': return Math.round(width*(1-Math.cos(Math.acos(i/width)))); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
68 |
case 'bite': return Math.round(width*(Math.cos(Math.asin((width-i-1)/width)))); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
69 |
case 'slide': return Math.round(width*(Math.atan2(i,width/i))); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
70 |
case 'jut': return Math.round(width*(Math.atan2(width,(width-i-1)))); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
71 |
case 'curl': return Math.round(width*(Math.atan(i))); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
72 |
case 'tear': return Math.round(width*(Math.cos(i))); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
73 |
case 'wicked': return Math.round(width*(Math.tan(i))); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
74 |
case 'long': return Math.round(width*(Math.sqrt(i))); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
75 |
case 'sculpt': return Math.round(width*(Math.log((width-i-1),width))); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
76 |
case 'dogfold': |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
77 |
case 'dog': return (i&1) ? (i+1) : width; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
78 |
case 'dog2': return (i&2) ? (i+1) : width; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
79 |
case 'dog3': return (i&3) ? (i+1) : width; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
80 |
case 'fray': return (i%2)*width; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
81 |
case 'notch': return width; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
82 |
case 'bevelfold': |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
83 |
case 'bevel': return i+1; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
84 |
} |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
85 |
}; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
86 |
|
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
87 |
$.fn.corner = function(options) { |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
88 |
// in 1.3+ we can fix mistakes with the ready state |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
89 |
if (this.length == 0) { |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
90 |
if (!$.isReady && this.selector) { |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
91 |
var s = this.selector, c = this.context; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
92 |
$(function() { |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
93 |
$(s,c).corner(options); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
94 |
}); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
95 |
} |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
96 |
return this; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
97 |
} |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
98 |
|
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
99 |
return this.each(function(index){ |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
100 |
var $this = $(this), |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
101 |
// meta values override options |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
102 |
o = [$this.attr($.fn.corner.defaults.metaAttr) || '', options || ''].join(' ').toLowerCase(), |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
103 |
keep = /keep/.test(o), // keep borders? |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
104 |
cc = ((o.match(/cc:(#[0-9a-f]+)/)||[])[1]), // corner color |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
105 |
sc = ((o.match(/sc:(#[0-9a-f]+)/)||[])[1]), // strip color |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
106 |
width = parseInt((o.match(/(\d+)px/)||[])[1]) || 10, // corner width |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
107 |
re = /round|bevelfold|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dogfold|dog/, |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
108 |
fx = ((o.match(re)||['round'])[0]), |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
109 |
fold = /dogfold|bevelfold/.test(o), |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
110 |
edges = { T:0, B:1 }, |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
111 |
opts = { |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
112 |
TL: /top|tl|left/.test(o), TR: /top|tr|right/.test(o), |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
113 |
BL: /bottom|bl|left/.test(o), BR: /bottom|br|right/.test(o) |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
114 |
}, |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
115 |
// vars used in func later |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
116 |
strip, pad, cssHeight, j, bot, d, ds, bw, i, w, e, c, common, $horz; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
117 |
|
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
118 |
if ( !opts.TL && !opts.TR && !opts.BL && !opts.BR ) |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
119 |
opts = { TL:1, TR:1, BL:1, BR:1 }; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
120 |
|
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
121 |
// support native rounding |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
122 |
if ($.fn.corner.defaults.useNative && fx == 'round' && (radius || moz || webkit) && !cc && !sc) { |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
123 |
if (opts.TL) |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
124 |
$this.css(radius ? 'border-top-left-radius' : moz ? '-moz-border-radius-topleft' : '-webkit-border-top-left-radius', width + 'px'); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
125 |
if (opts.TR) |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
126 |
$this.css(radius ? 'border-top-right-radius' : moz ? '-moz-border-radius-topright' : '-webkit-border-top-right-radius', width + 'px'); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
127 |
if (opts.BL) |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
128 |
$this.css(radius ? 'border-bottom-left-radius' : moz ? '-moz-border-radius-bottomleft' : '-webkit-border-bottom-left-radius', width + 'px'); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
129 |
if (opts.BR) |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
130 |
$this.css(radius ? 'border-bottom-right-radius' : moz ? '-moz-border-radius-bottomright' : '-webkit-border-bottom-right-radius', width + 'px'); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
131 |
return; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
132 |
} |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
133 |
|
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
134 |
strip = document.createElement('div'); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
135 |
$(strip).css({ |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
136 |
overflow: 'hidden', |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
137 |
height: '1px', |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
138 |
minHeight: '1px', |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
139 |
fontSize: '1px', |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
140 |
backgroundColor: sc || 'transparent', |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
141 |
borderStyle: 'solid' |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
142 |
}); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
143 |
|
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
144 |
pad = { |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
145 |
T: parseInt($.css(this,'paddingTop'))||0, R: parseInt($.css(this,'paddingRight'))||0, |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
146 |
B: parseInt($.css(this,'paddingBottom'))||0, L: parseInt($.css(this,'paddingLeft'))||0 |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
147 |
}; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
148 |
|
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
149 |
if (typeof this.style.zoom != undefined) this.style.zoom = 1; // force 'hasLayout' in IE |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
150 |
if (!keep) this.style.border = 'none'; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
151 |
strip.style.borderColor = cc || gpc(this.parentNode); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
152 |
cssHeight = $(this).outerHeight(); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
153 |
|
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
154 |
for (j in edges) { |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
155 |
bot = edges[j]; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
156 |
// only add stips if needed |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
157 |
if ((bot && (opts.BL || opts.BR)) || (!bot && (opts.TL || opts.TR))) { |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
158 |
strip.style.borderStyle = 'none '+(opts[j+'R']?'solid':'none')+' none '+(opts[j+'L']?'solid':'none'); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
159 |
d = document.createElement('div'); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
160 |
$(d).addClass('jquery-corner'); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
161 |
ds = d.style; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
162 |
|
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
163 |
bot ? this.appendChild(d) : this.insertBefore(d, this.firstChild); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
164 |
|
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
165 |
if (bot && cssHeight != 'auto') { |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
166 |
if ($.css(this,'position') == 'static') |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
167 |
this.style.position = 'relative'; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
168 |
ds.position = 'absolute'; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
169 |
ds.bottom = ds.left = ds.padding = ds.margin = '0'; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
170 |
if (expr) |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
171 |
ds.setExpression('width', 'this.parentNode.offsetWidth'); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
172 |
else |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
173 |
ds.width = '100%'; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
174 |
} |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
175 |
else if (!bot && $.browser.msie) { |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
176 |
if ($.css(this,'position') == 'static') |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
177 |
this.style.position = 'relative'; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
178 |
ds.position = 'absolute'; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
179 |
ds.top = ds.left = ds.right = ds.padding = ds.margin = '0'; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
180 |
|
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
181 |
// fix ie6 problem when blocked element has a border width |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
182 |
if (expr) { |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
183 |
bw = sz(this,'borderLeftWidth') + sz(this,'borderRightWidth'); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
184 |
ds.setExpression('width', 'this.parentNode.offsetWidth - '+bw+'+ "px"'); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
185 |
} |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
186 |
else |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
187 |
ds.width = '100%'; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
188 |
} |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
189 |
else { |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
190 |
ds.position = 'relative'; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
191 |
ds.margin = !bot ? '-'+pad.T+'px -'+pad.R+'px '+(pad.T-width)+'px -'+pad.L+'px' : |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
192 |
(pad.B-width)+'px -'+pad.R+'px -'+pad.B+'px -'+pad.L+'px'; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
193 |
} |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
194 |
|
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
195 |
for (i=0; i < width; i++) { |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
196 |
w = Math.max(0,getWidth(fx,i, width)); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
197 |
e = strip.cloneNode(false); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
198 |
e.style.borderWidth = '0 '+(opts[j+'R']?w:0)+'px 0 '+(opts[j+'L']?w:0)+'px'; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
199 |
bot ? d.appendChild(e) : d.insertBefore(e, d.firstChild); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
200 |
} |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
201 |
|
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
202 |
if (fold && $.support.boxModel) { |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
203 |
if (bot && noBottomFold) continue; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
204 |
for (c in opts) { |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
205 |
if (!opts[c]) continue; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
206 |
if (bot && (c == 'TL' || c == 'TR')) continue; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
207 |
if (!bot && (c == 'BL' || c == 'BR')) continue; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
208 |
|
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
209 |
common = { position: 'absolute', border: 'none', margin: 0, padding: 0, overflow: 'hidden', backgroundColor: strip.style.borderColor }; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
210 |
$horz = $('<div/>').css(common).css({ width: width + 'px', height: '1px' }); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
211 |
switch(c) { |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
212 |
case 'TL': $horz.css({ bottom: 0, left: 0 }); break; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
213 |
case 'TR': $horz.css({ bottom: 0, right: 0 }); break; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
214 |
case 'BL': $horz.css({ top: 0, left: 0 }); break; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
215 |
case 'BR': $horz.css({ top: 0, right: 0 }); break; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
216 |
} |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
217 |
d.appendChild($horz[0]); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
218 |
|
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
219 |
var $vert = $('<div/>').css(common).css({ top: 0, bottom: 0, width: '1px', height: width + 'px' }); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
220 |
switch(c) { |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
221 |
case 'TL': $vert.css({ left: width }); break; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
222 |
case 'TR': $vert.css({ right: width }); break; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
223 |
case 'BL': $vert.css({ left: width }); break; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
224 |
case 'BR': $vert.css({ right: width }); break; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
225 |
} |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
226 |
d.appendChild($vert[0]); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
227 |
} |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
228 |
} |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
229 |
} |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
230 |
} |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
231 |
}); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
232 |
}; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
233 |
|
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
234 |
$.fn.uncorner = function() { |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
235 |
if (radius || moz || webkit) |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
236 |
this.css(radius ? 'border-radius' : moz ? '-moz-border-radius' : '-webkit-border-radius', 0); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
237 |
$('div.jquery-corner', this).remove(); |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
238 |
return this; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
239 |
}; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
240 |
|
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
241 |
// expose options |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
242 |
$.fn.corner.defaults = { |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
243 |
useNative: true, // true if plugin should attempt to use native browser support for border radius rounding |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
244 |
metaAttr: 'data-corner' // name of meta attribute to use for options |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
245 |
}; |
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
246 |
|
69aa3e68c231
[js] update jquery.corner.js to the latest version (uses native css support for browser that provide it); closes #1625065
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4788
diff
changeset
|
247 |
})(jQuery); |