From edaf7ce86c10bafdf1eb554ed03910ec7b7be691 Mon Sep 17 00:00:00 2001 From: Crack Date: Mon, 26 Jul 2010 21:30:57 +0200 Subject: [PATCH] translate "More" tab cleanup code --- js/functions.js | 20 +++++++++----------- js/messages.php | 3 +++ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/js/functions.js b/js/functions.js index 73910e348..e1bc4f3fb 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1742,7 +1742,7 @@ function menuResize() var submenu = cnt.find('.submenu'); var submenu_w = submenu.outerWidth(true); var submenu_ul = submenu.find('ul'); - var li = $('#topmenu > li'); + var li = cnt.find('> li'); var li2 = submenu_ul.find('li'); var more_shown = li2.length > 0; var w = more_shown ? submenu_w : 0; @@ -1777,7 +1777,8 @@ function menuResize() for (var i = 0; i < li2.length; i++) { //console.log(li2[i], submenu_w); w += $(li2[i]).data('width'); - if (w+submenu_w < wmax ) {//|| (i == li2.length-1 && w < wmax) + // item fits or (it is the last item and it would fit if More got removed) + if (w+submenu_w < wmax || (i == li2.length-1 && w < wmax)) { $(li2[i]).insertBefore(submenu); if (i == li2.length-1) { submenu.hide(); @@ -1800,21 +1801,18 @@ $(function() { return; } // create submenu container - var link = $('') - .attr({href: '#', 'class': 'tab'}) - .text('More') + var link = $('', {href: '#', 'class': 'tab'}) + .text(PMA_messages['strMore']) .click(function(e) { e.preventDefault(); }); - var img = topmenu.find('li:first-child').find('img'); + var img = topmenu.find('li:first-child img'); if (img.length) { - img = img.clone(); - img.attr('src', img.attr('src').replace(/\/[^\/]+$/, '/b_more.png')).prependTo(link); + img.clone().attr('src', img.attr('src').replace(/\/[^\/]+$/, '/b_more.png')).prependTo(link); } - var submenu = $('
  • ') - .attr('class', 'submenu') + var submenu = $('
  • ', {'class': 'submenu'}) .append(link) - .append($('
      ').append($('#topmenu li.subitem'))) + .append($('
        ')) .mouseenter(function() { if ($(this).find('ul .tabactive').length == 0) { $(this).addClass('submenuhover').find('> a').addClass('tabactive'); diff --git a/js/messages.php b/js/messages.php index aeb93f56c..d86f1b33a 100644 --- a/js/messages.php +++ b/js/messages.php @@ -66,6 +66,9 @@ $js_messages['strChangeDisplay'] = __('Choose column to display'); $js_messages['strGeneratePassword'] = __('Generate password'); $js_messages['strGenerate'] = __('Generate'); +/* navigation tabs */ +$js_messages['strMore'] = __('More'); + echo "var PMA_messages = new Array();\n"; foreach ($js_messages as $name => $js_message) { PMA_printJsValue("PMA_messages['" . $name . "']", $js_message);