/* 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; var windowWidth = $(window).width(); if (windowWidth < 768) { $('#pma_navigation_resizer').css({ 'width': '0px' }); } // Sets the image for the left and right scroll indicator $('.scrollindicator--left').html($(PMA_getImage('b_left').toString())); $('.scrollindicator--right').html($(PMA_getImage('b_right').toString())); // Set the width of the navigation bar without scroll indicator $('.navigationbar').css({ 'width': widthCalculator.call($container) - 60 }); // Scroll the navigation bar on click $('.scrollindicator--right').on('click', function () { $('.navigationbar').scrollLeft($('.navigationbar').scrollLeft() + 70); }); $('.scrollindicator--left').on('click', function () { $('.navigationbar').scrollLeft($('.navigationbar').scrollLeft() - 70); }); // create submenu container var link = $('', { href: '#', 'class': 'tab nowrap' }) .text(PMA_messages.strMore) .on('click', false); // same as event.preventDefault() var img = $container.find('li img'); if (img.length) { $(PMA_getImage('b_more').toString()).prependTo(link); } var $submenu = $('
  • ', { 'class': 'submenu' }) .append(link) .append($('