Index: trunk/extensions/TreeAndMenu/star.js |
— | — | @@ -19,9 +19,11 @@ |
20 | 20 | $('div.tam-star').each( function() { |
21 | 21 | var tree = $(this); |
22 | 22 | var root = 'starnode' + window.stars.length; |
23 | | - tree.html( '<ul><li><a href="https://www.mediawiki.org/">root</a>' + tree.html() + '</li></ul>' ); |
| 23 | + tree.html( '<ul><li><a href="https://www.mediawiki.org/">root</a>' + tree.html() + '</li></ul>' ).css({ |
| 24 | + width: window.star_config.width, |
| 25 | + height: window.star_config.height |
| 26 | + }); |
24 | 27 | $('ul', tree).css('list-style','none'); |
25 | | - tree.css('width',window.star_config.width).css('height',window.star_config.height); |
26 | 28 | |
27 | 29 | // Change all the bullet list li's content into star nodes (divs with an image and the li content) |
28 | 30 | $('a', this).each( function() { |
— | — | @@ -63,11 +65,17 @@ |
64 | 66 | // Set initial position to parent |
65 | 67 | var ox = p.position().left + p.width() / 2; |
66 | 68 | var oy = p.position().top + p.height() / 2; |
67 | | - e.css('left', ox - e.width() / 2).css('top', oy - e.height() / 2); |
| 69 | + e.css({ |
| 70 | + left: ox - e.width() / 2, |
| 71 | + top: oy - e.height() / 2 |
| 72 | + }); |
68 | 73 | } |
69 | 74 | |
70 | 75 | // If root, set position to half width/height |
71 | | - else e.css('left', window.star_config.width / 2).css('top', window.star_config.height / 2); |
| 76 | + else e.css({ |
| 77 | + left: window.star_config.width / 2, |
| 78 | + top: window.star_config.height / 2 |
| 79 | + }); |
72 | 80 | |
73 | 81 | |
74 | 82 | // Create a unique ID and persistent data for this element |
— | — | @@ -85,11 +93,11 @@ |
86 | 94 | |
87 | 95 | // Make the root node visible |
88 | 96 | var e = $('#'+root); |
89 | | - var data = window.stars[0]; |
90 | | - var p = data.parent; |
91 | | - var ox = p.position().left + p.width() / 2; |
92 | | - var oy = p.position().top + p.height() / 2; |
93 | | - e.css('display','block').css('left',tree.left + tree.width()/2).css('top',tree.top + tree.height()/2); |
| 97 | + e.css({ |
| 98 | + display: 'block', |
| 99 | + left: tree.left + tree.width() / 2, |
| 100 | + top: tree.top + tree.height() / 2 |
| 101 | + }); |
94 | 102 | }); |
95 | 103 | }); |
96 | 104 | |
— | — | @@ -149,12 +157,13 @@ |
150 | 158 | var a = k * i + o; |
151 | 159 | var x = Math.cos(a) * r; |
152 | 160 | var y = Math.sin(a) * r; |
153 | | - child.css( 'display','block' ) |
154 | | - .css('left', ox + x - child.width() / 2) |
155 | | - .css('top', oy + y - child.height() / 2) |
156 | | - .css('color', col) |
157 | | - .css('display', display); |
158 | | - |
| 161 | + child.css({ |
| 162 | + display: display, |
| 163 | + left: ox + x - child.width() / 2, |
| 164 | + top: oy + y - child.height() / 2, |
| 165 | + color: col |
| 166 | + }); |
| 167 | + |
159 | 168 | // If closing, and this is the first iteration, close this child too if open |
160 | 169 | if( data.open && fx.pos == 0 && cdata.open ) animateNode(child); |
161 | 170 | } |