diff options
author | Tyron Madlener <tyronx@gmail.com> | 2011-08-08 17:35:10 +0400 |
---|---|---|
committer | Tyron Madlener <tyronx@gmail.com> | 2011-08-08 17:35:10 +0400 |
commit | 8cdfa37d461770a9605a6d37cf07733bb7ae1bc0 (patch) | |
tree | 72d5889d28b9aa720fca02b4a5fe0a73d6d4f68c /js/server_variables.js | |
parent | cf95fbdcb5ceeab4a916f087967a798b76001b31 (diff) | |
parent | 79df74937cd20a400837b76f264eef4a4f2fe245 (diff) |
Merge remote-tracking branch 'origin/master'
Conflicts:
js/functions.js
js/server_status.js
js/server_variables.js
libraries/advisory_rules.txt
server_status.php
Diffstat (limited to 'js/server_variables.js')
-rw-r--r-- | js/server_variables.js | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/js/server_variables.js b/js/server_variables.js index 3bd13a0123..faa379ad05 100644 --- a/js/server_variables.js +++ b/js/server_variables.js @@ -1,13 +1,14 @@ -function editVariable(link) { +function editVariable(link) +{ var varName = $(link).parent().parent().find('th:first').first().text().replace(/ /g,'_'); var mySaveLink = $(saveLink); var myCancelLink = $(cancelLink); var $cell = $(link).parent(); - + $cell.addClass('edit'); // remove edit link $cell.find('a.editLink').remove(); - + mySaveLink.click(function() { $.get('server_variables.php?' + url_query, { ajax_request: true, type: 'setval', varName: varName, varValue: $cell.find('input').attr('value') }, @@ -23,14 +24,14 @@ function editVariable(link) { ); return false; }); - + myCancelLink.click(function() { $cell.html($cell.find('span.oldContent').html()); $cell.removeClass('edit'); return false; }); - - + + $.get('server_variables.php?' + url_query, { ajax_request: true, type: 'getval', varName: varName }, function(data) { @@ -42,17 +43,17 @@ function editVariable(link) { $cell.find('table td:first').append(myCancelLink); } ); - + return false; } -$(function() { +$(function() { var textFilter=null; var odd_row=false; var testString = 'abcdefghijklmnopqrstuvwxyz0123456789,ABCEFGHIJKLMOPQRSTUVWXYZ'; var $tmpDiv; var charWidth; - + // Global vars editLink = '<a href="#" class="editLink" onclick="return editVariable(this);"><img class="icon ic_b_edit" src="themes/dot.gif" alt=""> '+PMA_messages['strEdit']+'</a>'; saveLink = '<a href="#" class="saveLink"><img class="icon ic_b_save" src="themes/dot.gif" alt=""> '+PMA_messages['strSave']+'</a> '; @@ -62,7 +63,7 @@ $(function() { $.ajaxSetup({ cache:false }); - + /* Variable editing */ if(isSuperuser) { $('table.data tbody tr td:nth-child(2)').hover( @@ -76,12 +77,12 @@ $(function() { } ); } - + /*** This code snippet takes care that the table stays readable. It cuts off long strings the table overlaps the window size ***/ $('table.data').after($tmpDiv=$('<span>'+testString+'</span>')); charWidth = $tmpDiv.width() / testString.length; $tmpDiv.remove(); - + $(window).resize(limitTableWidth); limitTableWidth(); @@ -107,22 +108,22 @@ $(function() { var charDiff; var maxTableWidth; var $tmpTable; - + $('table.data').after($tmpTable=$('<table id="testTable" style="width:100%;"><tr><td>'+testString+'</td></tr></table>')); - maxTableWidth = $('#testTable').width(); + maxTableWidth = $('#testTable').width(); $tmpTable.remove(); charDiff = ($('table.data').width()-maxTableWidth) / charWidth; - + if($('body').innerWidth() < $('table.data').width()+10 || $('body').innerWidth() > $('table.data').width()+20) { var maxChars=0; - + $('table.data tbody tr td:nth-child(2)').each(function() { maxChars=Math.max($(this).text().length,maxChars); }); - + // Do not resize smaller if there's only 50 chars displayed already if(charDiff > 0 && maxChars < 50) return; - + $('table.data tbody tr td:nth-child(2)').each(function() { if((charDiff>0 && $(this).text().length > maxChars-charDiff) || (charDiff<0 && $(this).find('abbr.cutoff').length>0)) { if($(this).find('abbr.cutoff').length > 0) @@ -132,7 +133,7 @@ $(function() { // Do not cut off elements with html in it and hope they are not too long if(fulltext.length != $(this).html().length) return 0; } - + if(fulltext.length < maxChars-charDiff) $(this).html(fulltext); else $(this).html('<abbr class="cutoff" title="'+fulltext+'">'+fulltext.substr(0,maxChars-charDiff-3)+'...</abbr>'); @@ -145,17 +146,17 @@ $(function() { odd_row=false; var mark_next=false; var firstCell; - + $('table.filteredData tbody tr').each(function() { firstCell = $(this).children(':first'); - + if(mark_next || textFilter==null || textFilter.exec(firstCell.text())) { // If current row is 'marked', also display next row if($(this).hasClass('marked') && !mark_next) mark_next=true; else mark_next=false; - odd_row = !odd_row; + odd_row = !odd_row; $(this).css('display',''); if(odd_row) { $(this).addClass('odd'); @@ -169,4 +170,4 @@ $(function() { } }); } -});
\ No newline at end of file +}); |