diff options
Diffstat (limited to 'docroot/classes/roundcorners.class.js')
-rwxr-xr-x | docroot/classes/roundcorners.class.js | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/docroot/classes/roundcorners.class.js b/docroot/classes/roundcorners.class.js new file mode 100755 index 0000000..c156d30 --- /dev/null +++ b/docroot/classes/roundcorners.class.js | |||
@@ -0,0 +1,60 @@ | |||
1 | /* | ||
2 | * Material Experience - Card Chip Class | ||
3 | * | ||
4 | * EYEMG - Interactive Media Group | ||
5 | * Created by Mike Crute (mcrute@eyemg.com) | ||
6 | * Updated by Mike Crute (mcrute@eyemg.com) on 9/26/07 | ||
7 | * | ||
8 | * An HTML based approach to drawing rounded corners using element | ||
9 | * "slices" to create the corners instead of images. This depends | ||
10 | * on a section in the stylesheet to work correctly. | ||
11 | * | ||
12 | * Code adapted from: http://www.html.it/articoli/nifty/index.html | ||
13 | */ | ||
14 | |||
15 | var RoundedCorners = Class.create(); | ||
16 | Object.extend(RoundedCorners.prototype, | ||
17 | { | ||
18 | // Direction table for rounded corners. | ||
19 | directions: | ||
20 | { | ||
21 | top : 'top', | ||
22 | bottom : 'bottom' | ||
23 | }, | ||
24 | |||
25 | /* | ||
26 | * Initialize the object | ||
27 | */ | ||
28 | initialize: function(color) | ||
29 | { | ||
30 | this.color = color; | ||
31 | }, | ||
32 | |||
33 | /* | ||
34 | * Creates a rounded corner container. | ||
35 | */ | ||
36 | get: function(direction) | ||
37 | { | ||
38 | var slicebox = document.createElement('b'); | ||
39 | slicebox.className = 'round'; | ||
40 | |||
41 | if (direction == this.directions.top) | ||
42 | { | ||
43 | var myEnum = $A($R(1,10)); | ||
44 | } | ||
45 | else | ||
46 | { | ||
47 | var myEnum = $A($R(1,10)).reverse(); | ||
48 | } | ||
49 | |||
50 | myEnum.each(function(item) | ||
51 | { | ||
52 | var corner = document.createElement('b'); | ||
53 | corner.className = 'rcSlice_' + item; | ||
54 | corner.style.backgroundColor = this.color; | ||
55 | slicebox.appendChild(corner); | ||
56 | }.bind(this)); | ||
57 | |||
58 | return slicebox; | ||
59 | } | ||
60 | }); \ No newline at end of file | ||