1 /* vim: set expandtab sw=4 ts=4 sts=4: */
9 * Unbind all event handlers before tearing down a page
11 AJAX.registerTeardown('server_status_variables.js', function() {
12 $('#filterAlert').unbind('change');
13 $('#filterText').unbind('keyup');
14 $('#filterCategory').unbind('change');
15 $('#dontFormat').unbind('change');
18 AJAX.registerOnload('server_status_variables.js', function() {
19 /*** Table sort tooltip ***/
21 $('table.sortable>thead>tr:first').find('th'),
23 PMA_messages['strSortHint']
25 initTableSorter('statustabs_allvars');
27 // Filters for status variables
28 var textFilter = null;
29 var alertFilter = $('#filterAlert').prop('checked');
30 var categoryFilter = $('#filterCategory').find(':selected').val();
32 var text = ''; // Holds filter text
34 /* 3 Filtering functions */
35 $('#filterAlert').change(function() {
36 alertFilter = this.checked;
40 $('#filterCategory').change(function() {
41 categoryFilter = $(this).val();
45 $('#dontFormat').change(function() {
46 // Hiding the table while changing values speeds up the process a lot
47 $('#serverstatusvariables').hide();
48 $('#serverstatusvariables td.value span.original').toggle(this.checked);
49 $('#serverstatusvariables td.value span.formatted').toggle(! this.checked);
50 $('#serverstatusvariables').show();
53 $('#filterText').keyup(function(e) {
54 var word = $(this).val().replace(/_/g, ' ');
55 if (word.length == 0) {
58 textFilter = new RegExp("(^| )" + word, 'i');
64 /* Filters the status variables by name/category/alert in the variables tab */
65 function filterVariables() {
69 if (categoryFilter.length > 0) {
70 section = categoryFilter;
73 if (section.length > 1) {
74 $('#linkSuggestions span').each(function() {
75 if ($(this).attr('class').indexOf('status_' + section) != -1) {
77 $(this).css('display', '');
79 $(this).css('display', 'none');
84 if (useful_links > 0) {
85 $('#linkSuggestions').css('display', '');
87 $('#linkSuggestions').css('display', 'none');
91 $('#serverstatusvariables th.name').each(function() {
92 if ((textFilter == null || textFilter.exec($(this).text()))
93 && (! alertFilter || $(this).next().find('span.attention').length>0)
94 && (categoryFilter.length == 0 || $(this).parent().hasClass('s_' + categoryFilter))
97 $(this).parent().css('display', '');
99 $(this).parent().addClass('odd');
100 $(this).parent().removeClass('even');
102 $(this).parent().addClass('even');
103 $(this).parent().removeClass('odd');
106 $(this).parent().css('display', 'none');