r63372 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63371‎ | r63372 | r63373 >
Date:21:55, 7 March 2010
Author:dale
Status:deferred
Tags:
Comment:
fixed IE subtitle menu display bug
Modified paths:
  • /branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.UploadForm.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/TimedText/jquery.menu/jquery.menu.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/TimedText/mw.TimedText.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/skins/ctrlBuilder.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/skins/kskin/kskinConfig.js (modified) (history)

Diff [purge]

Index: branches/js2-work/phase3/js/mwEmbed/skins/kskin/kskinConfig.js
@@ -115,7 +115,7 @@
116116 'top' : '0px',
117117 'left' : '0px',
118118 'bottom' : '0px',
119 - 'right' : '45px',
 119+ 'right' : '45px'
120120 } )
121121 for ( var menuItem in ctrlObj.supportedMenuItems ) {
122122 $menuScreens.append(
Index: branches/js2-work/phase3/js/mwEmbed/skins/ctrlBuilder.js
@@ -1402,19 +1402,7 @@
14031403 .buttonHover()
14041404 .click( function() {
14051405 ctrlObj.embedPlayer.showTextInterface();
1406 - } )
1407 - /*
1408 - * menu:
1409 - .menu( {
1410 - 'content' : gM('mwe-loading_txt')
1411 - 'positionOpts': {
1412 - 'directionV' : 'up',
1413 - 'offsetY' : 32,
1414 - 'directionH' : 'left',
1415 - 'offsetX' : -28
1416 - }
1417 - } );
1418 - */
 1406+ } )
14191407 }
14201408 },
14211409
Index: branches/js2-work/phase3/js/mwEmbed/modules/TimedText/jquery.menu/jquery.menu.js
@@ -101,7 +101,7 @@
102102 this.menuOpen = false;
103103 this.menuExists = false;
104104
105 - var options = jQuery.extend({
 105+ var options = jQuery.extend( {
106106 content: null,
107107 autoShow: false,
108108 width: 180, // width of menu container, must be set or passed in to calculate widths of child menus
@@ -171,11 +171,13 @@
172172 };
173173
174174 this.showMenu = function() {
175 - mw.log('$j.menu:: show menu' );
 175+ mw.log('$j.menu:: show menu' );
176176 killAllMenus();
177 - if (!menu.menuExists) {
 177+ mw.log('done:: killAllMenus' );
 178+ if ( ! menu.menuExists) {
178179 menu.create()
179180 };
 181+ mw.log('done:: menu.create' );
180182 caller
181183 .addClass('fg-menu-open')
182184 .addClass(options.callerOnState);
@@ -183,6 +185,8 @@
184186 menu.kill();
185187 return false;
186188 });
 189+ mw.log('done:: menu. binding container' );
 190+
187191 container.hide().slideDown(options.showSpeed).find('.fg-menu:eq(0)');
188192 menu.menuOpen = true;
189193 caller.removeClass(options.loadingState);
@@ -270,26 +274,39 @@
271275 });
272276 };
273277
274 - this.create = function() {
275 - container.css({ width: options.width }).appendTo('body').find('ul:first').not('.fg-menu-breadcrumb').addClass('fg-menu');
 278+ this.create = function() {
 279+ mw.log( "jquery.menu.create ");
 280+ container.css({
 281+ 'width' : options.width
 282+ })
 283+ .appendTo('body')
 284+ .find( 'ul:first' )
 285+ .not( '.fg-menu-breadcrumb' )
 286+ .addClass('fg-menu');
 287+
 288+
276289 container.find('ul, li a').addClass('ui-corner-all');
277290
278291 // aria roles & attributes
279 - container.find('ul').attr('role', 'menu').eq(0).attr('aria-activedescendant','active-menuitem').attr('aria-labelledby', caller.attr('id'));
280 - container.find('li').attr('role', 'menuitem');
281 - container.find('li:has(ul)').attr('aria-haspopup', 'true').find('ul').attr('aria-expanded', 'false');
282 - container.find('a').attr('tabindex', '-1');
 292+ container.find( 'ul' ).attr('role', 'menu').eq(0).attr('aria-activedescendant','active-menuitem').attr('aria-labelledby', caller.attr('id'));
 293+ container.find( 'li' ).attr('role', 'menuitem');
 294+ container.find( 'li:has(ul)' ).attr('aria-haspopup', 'true').find('ul').attr('aria-expanded', 'false');
 295+ container.find( 'a' ).attr('tabindex', '-1');
283296
284297 // when there are multiple levels of hierarchy, create flyout or drilldown menu
285 - if (container.find('ul').size() > 1) {
286 - if (options.flyOut) { menu.flyout(container, options); }
287 - else { menu.drilldown(container, options); }
288 - }
289 - else {
290 - container.find('a').click(function() {
291 - menu.chooseItem(this);
 298+ if ( container.find( 'ul' ).size() > 1 ) {
 299+ if ( options.flyOut ) {
 300+ mw.log(" call menu.flyout ");
 301+ menu.flyout(container, options);
 302+ } else {
 303+ mw.log(" call menu.drilldown ");
 304+ menu.drilldown(container, options);
 305+ }
 306+ } else {
 307+ container.find( 'a' ).click( function() {
 308+ menu.chooseItem( this );
292309 return false;
293 - });
 310+ } );
294311 };
295312
296313 if (options.linkHover) {
@@ -315,8 +332,8 @@
316333 },
317334 function() { $(this).removeClass(options.linkHoverSecondary); }
318335 );
319 - };
320 -
 336+ };
 337+
321338 menu.setPosition(container, caller, options);
322339 menu.menuExists = true;
323340 };
@@ -544,6 +561,8 @@
545562 - linkToFront: copy the menu link and place it on top of the menu (visual effect to make it look like it overlaps the object) */
546563
547564 Menu.prototype.setPosition = function(widget, caller, options) {
 565+ mw.log( 'setPosition' );
 566+
548567 var el = widget;
549568 var referrer = caller;
550569 var dims = {
@@ -557,6 +576,9 @@
558577
559578 var helper = $( '<div class="menuPositionHelper">' );
560579 helper.css( 'z-index', options.zindex );
 580+
 581+ mw.log("set z-index");
 582+
561583 // Hard code width height of button if unset ( crazy IE )
562584 if( isNaN( dims.refW ) || isNaN( dims.refH ) ) {
563585 dims.refH = 16;
@@ -569,10 +591,16 @@
570592 'width': dims.refW,
571593 'height': dims.refH
572594 });
 595+
 596+ mw.log("set helper.css ");
 597+
573598 el.wrap( helper );
 599+
 600+ mw.log("wrap helper");
 601+
574602 xVal = yVal = 0;
575 - // get X pos
576 - switch(options.positionOpts.posX) {
 603+ // get X pos
 604+ switch( options.positionOpts.posX ) {
577605 case 'left': xVal = 0;
578606 break;
579607 case 'center': xVal = dims.refW / 2;
@@ -582,7 +610,7 @@
583611 };
584612
585613 // get Y pos
586 - switch(options.positionOpts.posY) {
 614+ switch( options.positionOpts.posY ) {
587615 case 'top' : yVal = 0;
588616 break;
589617 case 'center' : yVal = dims.refH / 2;
@@ -590,24 +618,39 @@
591619 case 'bottom' : yVal = dims.refH;
592620 break;
593621 };
 622+
594623 // add the offsets (zero by default)
595 - xVal += options.positionOpts.offsetX;
596 - yVal += options.positionOpts.offsetY;
 624+ xVal += ( options.positionOpts.offsetX )? options.positionOpts.offsetX : 0;
 625+ yVal += ( options.positionOpts.offsetY )? options.positionOpts.offsetY : 0;
597626
 627+ mw.log(" about to position: " + yVal );
598628 // position the object vertically
599629 if (options.positionOpts.directionV == 'up') {
600 - el.css( { top: 'auto', bottom: yVal } );
 630+ el.css( {
 631+ 'top': 'auto',
 632+ 'bottom': yVal
 633+ } );
601634 if (options.positionOpts.detectV && !fitVertical(el)) {
602 - el.css({ bottom: 'auto', top: yVal });
 635+ el.css({
 636+ 'bottom' : 'auto',
 637+ 'top' : yVal
 638+ });
603639 }
604 - }
605 - else {
606 - el.css({ bottom: 'auto', top: yVal });
 640+ } else {
 641+ el.css({
 642+ 'bottom' : 'auto',
 643+ 'top' : yVal
 644+ });
607645 if (options.positionOpts.detectV && !fitVertical(el)) {
608 - el.css({ top: 'auto', bottom: yVal });
 646+ el.css({
 647+ 'top' : 'auto',
 648+ 'bottom' : yVal
 649+ });
609650 }
610651 };
611652
 653+ mw.log(" done with add the offsets && position the object vertically");
 654+
612655 // and horizontally
613656 if (options.positionOpts.directionH == 'left') {
614657 el.css({ left: 'auto', right: xVal });
@@ -622,6 +665,8 @@
623666 }
624667 };
625668
 669+ mw.log(" done with position the object horizontally");
 670+
626671 // if specified, clone the referring element and position it so that it appears on top of the menu
627672 if (options.positionOpts.linkToFront) {
628673 referrer.clone().addClass('linkClone').css({
@@ -634,6 +679,7 @@
635680 height: referrer.height()
636681 }).insertAfter(el);
637682 };
 683+ mw.log('done with all');
638684 };
639685
640686
Index: branches/js2-work/phase3/js/mwEmbed/modules/TimedText/mw.TimedText.js
@@ -211,7 +211,7 @@
212212 _this.menuTarget = target;
213213 var $menuButton = this.embedPlayer.$interface.find( '.timed-text' );
214214
215 - var positionOpts = null;
 215+ var positionOpts = { };
216216 if( this.embedPlayer.supports[ 'overlays' ] ){
217217 var positionOpts = {
218218 'directionV' : 'up',
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.UploadForm.js
@@ -684,4 +684,4 @@
685685 };
686686
687687
688 -} )( window.mw.UploadForm );
\ No newline at end of file
 688+} )( window.mw.UploadForm );

Status & tagging log