/* vim: set expandtab sw=4 ts=4 sts=4: */ /** * Handles the resizing of a menu according to the available screen width * * Uses themes/original/css/resizable-menu.css.php * * To initialise: * $('#myMenu').menuResizer(function () { * // This function will be called to find out how much * // available horizontal space there is for the menu * return $('body').width() - 5; // Some extra margin for good measure * }); * * To trigger a resize operation: * $('#myMenu').menuResizer('resize'); // Bind this to $(window).resize() * * To restore the menu to a state like before it was initialized: * $('#myMenu').menuResizer('destroy'); * * @package PhpMyAdmin */ (function ($) { function MenuResizer($container, widthCalculator) { var self = this; self.$container = $container; self.widthCalculator = widthCalculator; // create submenu container var link = $('', {href: '#', 'class': 'tab nowrap'}) .text(PMA_messages.strMore) .bind('click', false); // same as event.preventDefault() var img = $container.find('li img'); if (img.length) { $(PMA_getImage('b_more.png').toString()).prependTo(link); } var $submenu = $('
  • ', {'class': 'submenu'}) .append(link) .append($('