From: Alexander Ebert Date: Thu, 25 Sep 2014 19:21:15 +0000 (+0200) Subject: Overhauled flexible menus and added support for message tab menu X-Git-Tag: 2.1.0_Alpha_1~297^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d12b7e5cd95b0b5b0553651c39fee82e658c4f30;p=GitHub%2FWoltLab%2FWCF.git Overhauled flexible menus and added support for message tab menu --- diff --git a/wcfsetup/install/files/js/WCF.Message.js b/wcfsetup/install/files/js/WCF.Message.js index 37899c054a..28435c8600 100644 --- a/wcfsetup/install/files/js/WCF.Message.js +++ b/wcfsetup/install/files/js/WCF.Message.js @@ -3734,7 +3734,7 @@ $.widget('wcf.messageTabMenu', { * Creates the message tab menu. */ _create: function() { - var $tabs = this.element.find('> nav > ul > li'); + var $tabs = this.element.find('> nav > ul > li:not(.jsFlexibleMenuDropdown)'); var $tabContainers = this.element.find('> div, > fieldset'); if ($tabs.length != $tabContainers.length) { diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index f42d95b45b..f5397a0b57 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -631,6 +631,22 @@ $.fn.extend({ if (!duration || !parseInt(duration)) duration = 200; return this.hide(WCF.getEffect(this, 'fade'), { }, duration, callback); + }, + + /** + * Returns a CSS property as raw number. + * + * @param string property + */ + cssAsNumber: function(property) { + if (this.length) { + var $property = this.css(property); + if ($property !== undefined) { + return parseInt($property.replace(/px$/, '')); + } + } + + return 0; } }); @@ -5409,13 +5425,20 @@ WCF.CloseOverlayHandler = { } }, + /** + * Triggers the callbacks programmatically. + */ + forceExecution: function() { + this._executeCallbacks(); + }, + /** * Binds click event handler. */ _bindListener: function() { if (this._isListening) return; - $('body').click($.proxy(this._executeCallbacks, this)); + $(document.body).click($.proxy(this._executeCallbacks, this)); this._isListening = true; }, @@ -6677,7 +6700,7 @@ WCF.System.FlexibleMenu = { */ _registerTabMenus: function() { // register tab menus - $('.tabMenuContainer:not(.jsFlexibleMenuEnabled)').each(function(index, tabMenuContainer) { + $('.tabMenuContainer:not(.jsFlexibleMenuEnabled), .messageTabMenu:not(.jsFlexibleMenuEnabled)').each(function(index, tabMenuContainer) { var $navigation = $(tabMenuContainer).addClass('jsFlexibleMenuEnabled').children('nav'); if ($navigation.length && $navigation.find('> ul:eq(0) > li').length) { WCF.System.FlexibleMenu.registerMenu($navigation.wcfIdentify()); @@ -6710,7 +6733,7 @@ WCF.System.FlexibleMenu = { this._containerIDs.push(containerID); this._containers[containerID] = $container; this._menuItems[containerID] = $container.find('> ul:eq(0) > li'); - this._dropdowns[containerID] = $('').data('containerID', containerID).click($.proxy(this._click, this)); + this._dropdowns[containerID] = $('').data('containerID', containerID).click($.proxy(this._click, this)); this._dropdownMenus[containerID] = $('