Index: branches/js2-work/phase3/js/mwEmbed/skins/kskin/kskinConfig.js |
— | — | @@ -115,7 +115,7 @@ |
116 | 116 | 'top' : '0px', |
117 | 117 | 'left' : '0px', |
118 | 118 | 'bottom' : '0px', |
119 | | - 'right' : '45px', |
| 119 | + 'right' : '45px' |
120 | 120 | } ) |
121 | 121 | for ( var menuItem in ctrlObj.supportedMenuItems ) { |
122 | 122 | $menuScreens.append( |
Index: branches/js2-work/phase3/js/mwEmbed/skins/ctrlBuilder.js |
— | — | @@ -1402,19 +1402,7 @@ |
1403 | 1403 | .buttonHover() |
1404 | 1404 | .click( function() { |
1405 | 1405 | 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 | + } ) |
1419 | 1407 | } |
1420 | 1408 | }, |
1421 | 1409 | |
Index: branches/js2-work/phase3/js/mwEmbed/modules/TimedText/jquery.menu/jquery.menu.js |
— | — | @@ -101,7 +101,7 @@ |
102 | 102 | this.menuOpen = false; |
103 | 103 | this.menuExists = false; |
104 | 104 | |
105 | | - var options = jQuery.extend({ |
| 105 | + var options = jQuery.extend( { |
106 | 106 | content: null, |
107 | 107 | autoShow: false, |
108 | 108 | width: 180, // width of menu container, must be set or passed in to calculate widths of child menus |
— | — | @@ -171,11 +171,13 @@ |
172 | 172 | }; |
173 | 173 | |
174 | 174 | this.showMenu = function() { |
175 | | - mw.log('$j.menu:: show menu' ); |
| 175 | + mw.log('$j.menu:: show menu' ); |
176 | 176 | killAllMenus(); |
177 | | - if (!menu.menuExists) { |
| 177 | + mw.log('done:: killAllMenus' ); |
| 178 | + if ( ! menu.menuExists) { |
178 | 179 | menu.create() |
179 | 180 | }; |
| 181 | + mw.log('done:: menu.create' ); |
180 | 182 | caller |
181 | 183 | .addClass('fg-menu-open') |
182 | 184 | .addClass(options.callerOnState); |
— | — | @@ -183,6 +185,8 @@ |
184 | 186 | menu.kill(); |
185 | 187 | return false; |
186 | 188 | }); |
| 189 | + mw.log('done:: menu. binding container' ); |
| 190 | + |
187 | 191 | container.hide().slideDown(options.showSpeed).find('.fg-menu:eq(0)'); |
188 | 192 | menu.menuOpen = true; |
189 | 193 | caller.removeClass(options.loadingState); |
— | — | @@ -270,26 +274,39 @@ |
271 | 275 | }); |
272 | 276 | }; |
273 | 277 | |
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 | + |
276 | 289 | container.find('ul, li a').addClass('ui-corner-all'); |
277 | 290 | |
278 | 291 | // 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'); |
283 | 296 | |
284 | 297 | // 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 ); |
292 | 309 | return false; |
293 | | - }); |
| 310 | + } ); |
294 | 311 | }; |
295 | 312 | |
296 | 313 | if (options.linkHover) { |
— | — | @@ -315,8 +332,8 @@ |
316 | 333 | }, |
317 | 334 | function() { $(this).removeClass(options.linkHoverSecondary); } |
318 | 335 | ); |
319 | | - }; |
320 | | - |
| 336 | + }; |
| 337 | + |
321 | 338 | menu.setPosition(container, caller, options); |
322 | 339 | menu.menuExists = true; |
323 | 340 | }; |
— | — | @@ -544,6 +561,8 @@ |
545 | 562 | - linkToFront: copy the menu link and place it on top of the menu (visual effect to make it look like it overlaps the object) */ |
546 | 563 | |
547 | 564 | Menu.prototype.setPosition = function(widget, caller, options) { |
| 565 | + mw.log( 'setPosition' ); |
| 566 | + |
548 | 567 | var el = widget; |
549 | 568 | var referrer = caller; |
550 | 569 | var dims = { |
— | — | @@ -557,6 +576,9 @@ |
558 | 577 | |
559 | 578 | var helper = $( '<div class="menuPositionHelper">' ); |
560 | 579 | helper.css( 'z-index', options.zindex ); |
| 580 | + |
| 581 | + mw.log("set z-index"); |
| 582 | + |
561 | 583 | // Hard code width height of button if unset ( crazy IE ) |
562 | 584 | if( isNaN( dims.refW ) || isNaN( dims.refH ) ) { |
563 | 585 | dims.refH = 16; |
— | — | @@ -569,10 +591,16 @@ |
570 | 592 | 'width': dims.refW, |
571 | 593 | 'height': dims.refH |
572 | 594 | }); |
| 595 | + |
| 596 | + mw.log("set helper.css "); |
| 597 | + |
573 | 598 | el.wrap( helper ); |
| 599 | + |
| 600 | + mw.log("wrap helper"); |
| 601 | + |
574 | 602 | xVal = yVal = 0; |
575 | | - // get X pos |
576 | | - switch(options.positionOpts.posX) { |
| 603 | + // get X pos |
| 604 | + switch( options.positionOpts.posX ) { |
577 | 605 | case 'left': xVal = 0; |
578 | 606 | break; |
579 | 607 | case 'center': xVal = dims.refW / 2; |
— | — | @@ -582,7 +610,7 @@ |
583 | 611 | }; |
584 | 612 | |
585 | 613 | // get Y pos |
586 | | - switch(options.positionOpts.posY) { |
| 614 | + switch( options.positionOpts.posY ) { |
587 | 615 | case 'top' : yVal = 0; |
588 | 616 | break; |
589 | 617 | case 'center' : yVal = dims.refH / 2; |
— | — | @@ -590,24 +618,39 @@ |
591 | 619 | case 'bottom' : yVal = dims.refH; |
592 | 620 | break; |
593 | 621 | }; |
| 622 | + |
594 | 623 | // 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; |
597 | 626 | |
| 627 | + mw.log(" about to position: " + yVal ); |
598 | 628 | // position the object vertically |
599 | 629 | if (options.positionOpts.directionV == 'up') { |
600 | | - el.css( { top: 'auto', bottom: yVal } ); |
| 630 | + el.css( { |
| 631 | + 'top': 'auto', |
| 632 | + 'bottom': yVal |
| 633 | + } ); |
601 | 634 | if (options.positionOpts.detectV && !fitVertical(el)) { |
602 | | - el.css({ bottom: 'auto', top: yVal }); |
| 635 | + el.css({ |
| 636 | + 'bottom' : 'auto', |
| 637 | + 'top' : yVal |
| 638 | + }); |
603 | 639 | } |
604 | | - } |
605 | | - else { |
606 | | - el.css({ bottom: 'auto', top: yVal }); |
| 640 | + } else { |
| 641 | + el.css({ |
| 642 | + 'bottom' : 'auto', |
| 643 | + 'top' : yVal |
| 644 | + }); |
607 | 645 | if (options.positionOpts.detectV && !fitVertical(el)) { |
608 | | - el.css({ top: 'auto', bottom: yVal }); |
| 646 | + el.css({ |
| 647 | + 'top' : 'auto', |
| 648 | + 'bottom' : yVal |
| 649 | + }); |
609 | 650 | } |
610 | 651 | }; |
611 | 652 | |
| 653 | + mw.log(" done with add the offsets && position the object vertically"); |
| 654 | + |
612 | 655 | // and horizontally |
613 | 656 | if (options.positionOpts.directionH == 'left') { |
614 | 657 | el.css({ left: 'auto', right: xVal }); |
— | — | @@ -622,6 +665,8 @@ |
623 | 666 | } |
624 | 667 | }; |
625 | 668 | |
| 669 | + mw.log(" done with position the object horizontally"); |
| 670 | + |
626 | 671 | // if specified, clone the referring element and position it so that it appears on top of the menu |
627 | 672 | if (options.positionOpts.linkToFront) { |
628 | 673 | referrer.clone().addClass('linkClone').css({ |
— | — | @@ -634,6 +679,7 @@ |
635 | 680 | height: referrer.height() |
636 | 681 | }).insertAfter(el); |
637 | 682 | }; |
| 683 | + mw.log('done with all'); |
638 | 684 | }; |
639 | 685 | |
640 | 686 | |
Index: branches/js2-work/phase3/js/mwEmbed/modules/TimedText/mw.TimedText.js |
— | — | @@ -211,7 +211,7 @@ |
212 | 212 | _this.menuTarget = target; |
213 | 213 | var $menuButton = this.embedPlayer.$interface.find( '.timed-text' ); |
214 | 214 | |
215 | | - var positionOpts = null; |
| 215 | + var positionOpts = { }; |
216 | 216 | if( this.embedPlayer.supports[ 'overlays' ] ){ |
217 | 217 | var positionOpts = { |
218 | 218 | 'directionV' : 'up', |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.UploadForm.js |
— | — | @@ -684,4 +684,4 @@ |
685 | 685 | }; |
686 | 686 | |
687 | 687 | |
688 | | -} )( window.mw.UploadForm ); |
\ No newline at end of file |
| 688 | +} )( window.mw.UploadForm ); |