Version 3.1.4
This commit is contained in:
1 parent
1d4720f3e2
commit
ae5c01cc78
2563 files changed
+283048
-240689
No files matched your search
@@ -46,6 +46,11 @@ _menu.prototype.menus = {
|
||||
|
||||
docCloseAll: function( e )
|
||||
{
|
||||
if ( Event.element(e).up('.ipbmenu_content') )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if( ( !Event.isLeftClick(e) || e.ctrlKey == true || e.keyCode == 91 ) && !Prototype.Browser.IE ) // IE handles this fine anyway
|
||||
{
|
||||
// This line caused the IPB3 preview to break spectacularly.
|
||||
@@ -61,18 +66,23 @@ _menu.prototype.menus = {
|
||||
closeAll: function( except )
|
||||
{
|
||||
ipb.menus.registered.each( function(menu, force){
|
||||
if( ( except && menu.key != except ) )
|
||||
|
||||
if( typeof( except ) == 'undefined' || ( except && menu.key != except ) )
|
||||
{
|
||||
menu.value.doClose();
|
||||
try{
|
||||
menu.value.doClose();
|
||||
} catch(err) {
|
||||
// Assume this menu gone byebye
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ipb.menus.init();
|
||||
|
||||
_menu.prototype.Menu = Class.create({
|
||||
initialize: function( source, target, options ){
|
||||
initialize: function( source, target, options, callbacks ){
|
||||
if( !$( source ) || !$( target ) ){ return; }
|
||||
if( !$( source ).id ){
|
||||
$( source ).identify();
|
||||
@@ -80,6 +90,7 @@ _menu.prototype.Menu = Class.create({
|
||||
this.id = $( source ).id + '_menu';
|
||||
this.source = $( source );
|
||||
this.target = $( target );
|
||||
this.callbacks = callbacks || {};
|
||||
|
||||
this.options = Object.extend( {
|
||||
eventType: 'click',
|
||||
@@ -116,6 +127,11 @@ _menu.prototype.Menu = Class.create({
|
||||
});
|
||||
|
||||
ipb.menus.register( $( source ).id, this );
|
||||
|
||||
if( Object.isFunction( this.callbacks['afterInit'] ) )
|
||||
{
|
||||
this.callbacks['afterInit']( this );
|
||||
}
|
||||
},
|
||||
|
||||
doOpen: function()
|
||||
@@ -260,12 +276,22 @@ _menu.prototype.Menu = Class.create({
|
||||
$( this.target ).setStyle( 'top: ' + (pos.top-1) + 'px; left: ' + pos.left + 'px;' );*/
|
||||
|
||||
// And show
|
||||
new Effect.Appear( $( this.target ), { duration: 0.2 } );
|
||||
new Effect.Appear( $( this.target ), { duration: 0.2, afterFinish: function(e){
|
||||
if( Object.isFunction( this.callbacks['afterOpen'] ) )
|
||||
{
|
||||
this.callbacks['afterOpen']( this );
|
||||
}
|
||||
}.bind(this) } );
|
||||
},
|
||||
|
||||
doClose: function()
|
||||
{
|
||||
new Effect.Fade( $( this.target ), { duration: 0.3 } );
|
||||
new Effect.Fade( $( this.target ), { duration: 0.3, afterFinish: function(e){
|
||||
if( Object.isFunction( this.callbacks['afterClose'] ) )
|
||||
{
|
||||
this.callbacks['afterClose']( this );
|
||||
}
|
||||
}.bind( this ) } );
|
||||
},
|
||||
|
||||
targetClick: function(e)
|
||||
@@ -281,9 +307,21 @@ _menu.prototype.Menu = Class.create({
|
||||
Event.stop(e);
|
||||
|
||||
if( $( this.target ).visible() ){
|
||||
|
||||
if( Object.isFunction( this.callbacks['beforeClose'] ) )
|
||||
{
|
||||
this.callbacks['beforeClose']( this );
|
||||
}
|
||||
|
||||
this.doClose();
|
||||
} else {
|
||||
ipb.menus.closeAll( $(this.source).id );
|
||||
|
||||
if( Object.isFunction( this.callbacks['beforeOpen'] ) )
|
||||
{
|
||||
this.callbacks['beforeOpen']( this );
|
||||
}
|
||||
|
||||
this.doOpen();
|
||||
}
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user