r98134 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98133‎ | r98134 | r98135 >
Date:15:10, 26 September 2011
Author:werdna
Status:ok
Tags:
Comment:
Progress on fixing MoodBar IE7 bug:
* Instead of fixing the width at the browser calculated width, come up with our own width.
* Instead of using divs floated left, use spans inside a horizontally centered variable-width block element. This is a more robust way of centering the types.
* Stick it all inside another container, allowing that inner container to be centered.
Modified paths:
  • /trunk/extensions/MoodBar/modules/ext.moodBar/ext.moodBar.core.css (modified) (history)
  • /trunk/extensions/MoodBar/modules/ext.moodBar/ext.moodBar.core.js (modified) (history)

Diff [purge]

Index: trunk/extensions/MoodBar/modules/ext.moodBar/ext.moodBar.core.css
@@ -40,17 +40,23 @@
4141 }
4242
4343 .mw-moodBar-types {
44 - overflow: hidden; /* clear */
45 - margin: 0 30px;
 44+ margin: 0 auto;
 45+ width: auto;
 46+ display: inline-block;
 47+/* display: inline;*/
4648 }
4749
4850 .mw-moodBar-type {
49 - float: left;
5051 min-width: 42px;
5152 margin: 15px;
5253 padding: 42px 0 5px 0;
5354 /* @embed */
5455 background: transparent url(images/type-unknown.png) center top no-repeat;
 56+ display: inline-block;
 57+ /*display: inline;*/
 58+}
 59+
 60+.mw-moodBar-types-container {
5561 text-align: center;
5662 }
5763
Index: trunk/extensions/MoodBar/modules/ext.moodBar/ext.moodBar.core.js
@@ -17,7 +17,9 @@
1818 </div></div>',
1919 userinput: '\
2020 <div class="mw-moodBar-overlayTitle"><html:msg key="INTROTITLE" /></div>\
21 - <div class="mw-moodBar-types"></div>\
 21+ <div class="mw-moodBar-types-container">\
 22+ <div class="mw-moodBar-types"></div>\
 23+ </div>\
2224 <div class="mw-moodBar-form">\
2325 <div class="mw-moodBar-formTitle">\
2426 <span class="mw-moodBar-formNote"><html:msg key="moodbar-form-note" /></span>\
@@ -37,7 +39,7 @@
3840 <div class="mw-moodBar-overlayWhatContent"></div>\
3941 </span>',
4042 type: '\
41 - <div class="mw-moodBar-type mw-moodBar-type-$1" rel="$1">\
 43+ <span class="mw-moodBar-type mw-moodBar-type-$1" rel="$1">\
4244 <span class="mw-moodBar-typeTitle"><html:msg key="moodbar-type-$1-title" /></span>\
4345 </div>',
4446 loading: '\
@@ -227,13 +229,26 @@
228230 .end();
229231 mb.swapContent( mb.tpl.userinput );
230232
231 - mb.ui.overlay
232 - // Inject overlay
233 - .appendTo( 'body' )
234 - // Fix the width after the icons and titles are localized and inserted
235 - .width( function( i, width ) {
236 - return width + 10;
237 - } );
 233+ mb.ui.overlay.appendTo( 'body' );
 234+ mb.ui.overlay.show();
 235+
 236+ // Get the width of the types element, and add 100px
 237+ // 52px in known margins, 58px seems to be a necessary
 238+ // fudge factor, plus 30px so the close button doesn't collide
 239+ // with the rounded corners
 240+ var newWidth = mb.ui.overlay
 241+ .find('.mw-moodBar-types')
 242+ .width() + 140;
 243+ var titleWidth = mb.ui.overlay
 244+ .find('.mw-moodBar-overlayTitle')
 245+ .width() + 100;
 246+
 247+ if ( newWidth < titleWidth ) {
 248+ newWidth = titleWidth;
 249+ }
 250+
 251+ mb.ui.overlay.width(newWidth);
 252+ mb.ui.overlay.hide();
238253
239254 // Bind triger
240255 mb.ui.trigger.click( mb.event.trigger );

Follow-up revisions

RevisionCommit summaryAuthorDate
r98658Fix IE7 compatibility with MoodBar: Now appears normally, except without roun...werdna07:06, 2 October 2011

Status & tagging log