r70395 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70394‎ | r70395 | r70396 >
Date:18:35, 3 August 2010
Author:dale
Status:deferred
Tags:
Comment:
menu updates for sequencer menu usage to support divider and disabled class
Modified paths:
  • /trunk/extensions/JS2Support/mwEmbed/libraries/jquery/plugins/jquery.menu/jquery.menu.js (modified) (history)

Diff [purge]

Index: trunk/extensions/JS2Support/mwEmbed/libraries/jquery/plugins/jquery.menu/jquery.menu.js
@@ -5,11 +5,17 @@
66 By: Maggie Costello Wachs (maggie@filamentgroup.com) and Scott Jehl (scott@filamentgroup.com)
77 http://www.filamentgroup.com
88 * reference articles: http://www.filamentgroup.com/lab/jquery_ipod_style_drilldown_menu/
 9+
 10+* modified by Michael Dale, ( michael.dale@kaltura.com )
911
1012 Copyright (c) 2009 Filament Group
1113 Dual licensed under the MIT (filamentgroup.com/examples/mit-license.txt) and GPL (filamentgroup.com/examples/gpl-license.txt) licenses.
1214
13 -NOTE: mvEmbed will switch to jquery ui menu once that is released
 15+NOTE: mwEmbed will switch to jquery ui menu once that is released
 16+NOTE: This menu contains several customizations for use in mwEmbed modules::
 17+
 18+* added getLineItem helper function
 19+* added special class "divider" that is non selectable menu item horizontal hr
1420 --------------------------------------------------------------------*/
1521
1622
@@ -120,6 +126,7 @@
121127 linkToFront: false
122128 },
123129 showSpeed: 200, // show/hide speed in milliseconds
 130+ createMenuCallback: null,
124131 callerOnState: 'ui-state-active', // class to change the appearance of the link/button when the menu is showing
125132 loadingState: 'ui-state-loading', // class added to the link/button while the menu is created
126133 linkHover: 'ui-state-hover', // class for menu option hover state
@@ -173,11 +180,11 @@
174181 this.showMenu = function() {
175182 mw.log('$j.menu:: show menu' );
176183 killAllMenus();
177 - mw.log('done:: killAllMenus' );
 184+ mw.log('jquery.menu:: killAllMenus' );
178185 if ( ! menu.menuExists) {
179186 menu.create()
180187 };
181 - mw.log('done:: menu.create' );
 188+ mw.log('jquery.menu:: menu.create' );
182189 caller
183190 .addClass('fg-menu-open')
184191 .addClass(options.callerOnState);
@@ -185,7 +192,7 @@
186193 menu.kill();
187194 return false;
188195 });
189 - mw.log('done:: menu. binding container' );
 196+ mw.log('jquery.menu:: menu. binding container' );
190197
191198 container.hide().slideDown(options.showSpeed).find('.fg-menu:eq(0)');
192199 menu.menuOpen = true;
@@ -271,7 +278,7 @@
272279 };
273280 break;
274281 };
275 - });
 282+ });
276283 };
277284
278285 this.create = function() {
@@ -314,11 +321,16 @@
315322 allLinks.hover(
316323 function() {
317324 var menuitem = $(this);
318 - $('.'+options.linkHover).removeClass(options.linkHover).blur().parent().removeAttr('id');
319 - $(this).addClass(options.linkHover).focus().parent().attr('id','active-menuitem');
 325+ var menuli = menuitem.parent();
 326+ if( !menuli.hasClass('divider') && !menuli.hasClass('disabled') ){
 327+ $('.'+options.linkHover).removeClass(options.linkHover).blur().parent().removeAttr('id');
 328+ $(this).addClass(options.linkHover).focus().parent().addClass('active-menuitem');
 329+ }
320330 },
321331 function() {
322 - $(this).removeClass(options.linkHover).blur().parent().removeAttr('id');
 332+ if( !menuitem.hasClass('divider') && !menuitem.hasClass('disabled') ){
 333+ $(this).removeClass(options.linkHover).blur().parent().removeClass('active-menuitem');
 334+ }
323335 }
324336 );
325337 };
@@ -336,6 +348,10 @@
337349
338350 menu.setPosition(container, caller, options);
339351 menu.menuExists = true;
 352+
 353+ if( typeof options.createMenuCallback == 'function' ){
 354+ options.createMenuCallback();
 355+ }
340356 };
341357
342358 this.chooseItem = function(item) {
@@ -786,4 +802,3 @@
787803 };
788804
789805 } )( jQuery );
790 -

Status & tagging log