diff options
author | Michal Čihař <mcihar@suse.cz> | 2013-07-30 16:20:44 +0400 |
---|---|---|
committer | Michal Čihař <mcihar@suse.cz> | 2013-07-30 16:36:43 +0400 |
commit | 3fc2ab9cf9f4be2b8f37d2b63d32914c9c457f00 (patch) | |
tree | a70d95d095117f008fd8d8a1ec37dc1197d18fde /js/tbl_structure.js | |
parent | dc201c3a7a69e262f76c970f5aeb78e771c3c62a (diff) |
Move function declaration to top
Diffstat (limited to 'js/tbl_structure.js')
-rw-r--r-- | js/tbl_structure.js | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/js/tbl_structure.js b/js/tbl_structure.js index 3f45583d2f..03ea6e94fe 100644 --- a/js/tbl_structure.js +++ b/js/tbl_structure.js @@ -19,6 +19,38 @@ */ /** + * This function returns the horizontal space available for the menu in pixels. + * To calculate this value we start we the width of the main panel, then we + * substract the margin of the page content, then we substract any cellspacing + * that the table may have (original theme only) and finally we substract the + * width of all columns of the table except for the last one (which is where + * the menu will go). What we should end up with is the distance between the + * start of the last column on the table and the edge of the page, again this + * is the space available for the menu. + * + * In the case where the table cell where the menu will be displayed is already + * off-screen (the table is wider than the page), a negative value will be returned, + * but this will be treated as a zero by the menuResizer plugin. + * + * @return int + */ +function PMA_tbl_structure_menu_resizer_callback() { + var pagewidth = $('body').width(); + var $page = $('#page_content'); + pagewidth -= $page.outerWidth(true) - $page.outerWidth(); + var columnsWidth = 0; + var $columns = $('#tablestructure').find('tr:eq(1)').find('td,th'); + $columns.not(':last').each(function () { + columnsWidth += $(this).outerWidth(true); + }); + var totalCellSpacing = $('#tablestructure').width(); + $columns.each(function () { + totalCellSpacing -= $(this).outerWidth(true); + }); + return pagewidth - columnsWidth - totalCellSpacing - 15; // 15px extra margin +} + +/** * Reload fields table */ function reloadFieldForm(message) { @@ -74,12 +106,12 @@ AJAX.registerOnload('tbl_structure.js', function () { //User wants to submit the form $msg = PMA_ajaxShowMessage(); $.post($form.attr('action'), $form.serialize() + '&do_save_data=1', function (data) { - if ($("#sqlqueryresults").length != 0) { + if ($("#sqlqueryresults").length !== 0) { $("#sqlqueryresults").remove(); - } else if ($(".error:not(.tab)").length != 0) { + } else if ($(".error:not(.tab)").length !== 0) { $(".error:not(.tab)").remove(); } - if (data.success == true) { + if (data.success === true) { $("#page_content") .empty() .append(data.message) @@ -174,7 +206,7 @@ AJAX.registerOnload('tbl_structure.js', function () { $(this).PMA_confirm(question, $(this).attr('href'), function (url) { var $msg = PMA_ajaxShowMessage(PMA_messages.strDroppingColumn, false); $.get(url, {'is_js_confirmed' : 1, 'ajax_request' : true, 'ajax_page_request' : true}, function (data) { - if (data.success == true) { + if (data.success === true) { PMA_ajaxRemoveMessage($msg); if ($('#result_query').length) { $('#result_query').remove(); @@ -372,38 +404,6 @@ AJAX.registerOnload('tbl_structure.js', function () { }); }); -/** - * This function returns the horizontal space available for the menu in pixels. - * To calculate this value we start we the width of the main panel, then we - * substract the margin of the page content, then we substract any cellspacing - * that the table may have (original theme only) and finally we substract the - * width of all columns of the table except for the last one (which is where - * the menu will go). What we should end up with is the distance between the - * start of the last column on the table and the edge of the page, again this - * is the space available for the menu. - * - * In the case where the table cell where the menu will be displayed is already - * off-screen (the table is wider than the page), a negative value will be returned, - * but this will be treated as a zero by the menuResizer plugin. - * - * @return int - */ -function PMA_tbl_structure_menu_resizer_callback() { - var pagewidth = $('body').width(); - var $page = $('#page_content'); - pagewidth -= $page.outerWidth(true) - $page.outerWidth(); - var columnsWidth = 0; - var $columns = $('#tablestructure').find('tr:eq(1)').find('td,th'); - $columns.not(':last').each(function () { - columnsWidth += $(this).outerWidth(true); - }); - var totalCellSpacing = $('#tablestructure').width(); - $columns.each(function () { - totalCellSpacing -= $(this).outerWidth(true); - }); - return pagewidth - columnsWidth - totalCellSpacing - 15; // 15px extra margin -} - /** Handler for "More" dropdown in structure table rows */ AJAX.registerOnload('tbl_structure.js', function () { if ($('#fieldsForm').hasClass('HideStructureActions')) { |