r113226 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113225‎ | r113226 | r113227 >
Date:12:07, 7 March 2012
Author:nad
Status:deferred
Tags:
Comment:
tidy up jQuery css statements
Modified paths:
  • /trunk/extensions/TreeAndMenu/star.js (modified) (history)

Diff [purge]

Index: trunk/extensions/TreeAndMenu/star.js
@@ -19,9 +19,11 @@
2020 $('div.tam-star').each( function() {
2121 var tree = $(this);
2222 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+ });
2427 $('ul', tree).css('list-style','none');
25 - tree.css('width',window.star_config.width).css('height',window.star_config.height);
2628
2729 // Change all the bullet list li's content into star nodes (divs with an image and the li content)
2830 $('a', this).each( function() {
@@ -63,11 +65,17 @@
6466 // Set initial position to parent
6567 var ox = p.position().left + p.width() / 2;
6668 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+ });
6873 }
6974
7075 // 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+ });
7280
7381
7482 // Create a unique ID and persistent data for this element
@@ -85,11 +93,11 @@
8694
8795 // Make the root node visible
8896 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+ });
94102 });
95103 });
96104
@@ -149,12 +157,13 @@
150158 var a = k * i + o;
151159 var x = Math.cos(a) * r;
152160 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+
159168 // If closing, and this is the first iteration, close this child too if open
160169 if( data.open && fx.pos == 0 && cdata.open ) animateNode(child);
161170 }

Status & tagging log