');
}
} else {
- $('head').append('');
+ $head.append('');
}
};
diff --git a/js/gis_data_editor.js b/js/gis_data_editor.js
index 2808fc407e..86cae9e870 100644
--- a/js/gis_data_editor.js
+++ b/js/gis_data_editor.js
@@ -25,7 +25,7 @@ function prepareJSVersion() {
// Change the text on the submit button
$("input[name='gis_data[save]']")
- .attr('value', PMA_messages['strCopy'])
+ .val(PMA_messages['strCopy'])
.insertAfter($('#gis_data_textarea'))
.before(' ');
@@ -44,7 +44,7 @@ function prepareJSVersion() {
var classes = $button.attr('class');
$button
.after('+ ' + $button.attr('value') + ' ')
+ + '">+ ' + $button.val() + '')
.remove();
});
}
@@ -276,11 +276,11 @@ $(document).ready(function() {
var prefix = name.substr(0, name.length - 11);
// Find the number of points
var $noOfPointsInput = $("input[name='" + prefix + "[no_of_points]" + "']");
- var noOfPoints = parseInt($noOfPointsInput.attr('value'));
+ var noOfPoints = parseInt($noOfPointsInput.val());
// Add the new data point
var html = addDataPoint(noOfPoints, prefix);
$a.before(html);
- $noOfPointsInput.attr('value', noOfPoints + 1);
+ $noOfPointsInput.val(noOfPoints + 1);
});
/**
@@ -296,7 +296,7 @@ $(document).ready(function() {
// Find the number of lines
var $noOfLinesInput = $("input[name='" + prefix + "[no_of_lines]" + "']");
- var noOfLines = parseInt($noOfLinesInput.attr('value'));
+ var noOfLines = parseInt($noOfLinesInput.val());
// Add the new linesting of inner ring based on the type
var html = ' ';
@@ -315,7 +315,7 @@ $(document).ready(function() {
+ PMA_messages['strAddPoint'] + ' ';
$a.before(html);
- $noOfLinesInput.attr('value', noOfLines + 1);
+ $noOfLinesInput.val(noOfLines + 1);
});
/**
@@ -328,7 +328,7 @@ $(document).ready(function() {
var prefix = name.substr(0, name.length - 13);
// Find the number of polygons
var $noOfPolygonsInput = $("input[name='" + prefix + "[no_of_polygons]" + "']");
- var noOfPolygons = parseInt($noOfPolygonsInput.attr('value'));
+ var noOfPolygons = parseInt($noOfPolygonsInput.val());
// Add the new polygon
var html = PMA_messages['strPolygon'] + (noOfPolygons + 1) + ': ';
@@ -344,7 +344,7 @@ $(document).ready(function() {
+ PMA_messages['strAddInnerRing'] + ' ';
$a.before(html);
- $noOfPolygonsInput.attr('value', noOfPolygons + 1);
+ $noOfPolygonsInput.val(noOfPolygons + 1);
});
/**
@@ -355,7 +355,7 @@ $(document).ready(function() {
var prefix = 'gis_data[GEOMETRYCOLLECTION]';
// Find the number of geoms
var $noOfGeomsInput = $("input[name='" + prefix + "[geom_count]" + "']");
- var noOfGeoms = parseInt($noOfGeomsInput.attr('value'));
+ var noOfGeoms = parseInt($noOfGeomsInput.val());
var html1 = PMA_messages['strGeometry'] + (noOfGeoms + 1) + ': ';
var $geomType = $("select[name='gis_data[" + (noOfGeoms - 1) + "][gis_type]']").clone();
@@ -368,6 +368,6 @@ $(document).ready(function() {
+ ' ';
$a.before(html1); $geomType.insertBefore($a); $a.before(html2);
- $noOfGeomsInput.attr('value', noOfGeoms + 1);
+ $noOfGeomsInput.val(noOfGeoms + 1);
});
});
diff --git a/js/import.js b/js/import.js
index f1ab31bfe0..ec5fc9b5da 100644
--- a/js/import.js
+++ b/js/import.js
@@ -14,7 +14,7 @@ function changePluginOpts()
$(".format_specific_options").each(function() {
$(this).hide();
});
- var selected_plugin_name = $("#plugins option:selected").attr("value");
+ var selected_plugin_name = $("#plugins option:selected").val();
$("#" + selected_plugin_name + "_options").fadeIn('slow');
if(selected_plugin_name == "csv") {
$("#import_notification").text(PMA_messages['strImportCSV']);
@@ -38,8 +38,8 @@ function matchFile(fname)
}
// Only toggle if the format of the file can be imported
if($("select[name='format'] option").filterByValue(fname_array[len - 1]).length == 1) {
- $("#plugins option:selected").removeAttr("selected");
- $("select[name='format'] option").filterByValue(fname_array[len - 1]).attr('selected', 'selected');
+ $("#plugins option:selected").removeProp("selected");
+ $("select[name='format'] option").filterByValue(fname_array[len - 1]).prop('selected', true);
changePluginOpts();
}
}
@@ -54,11 +54,11 @@ $(document).ready(function() {
});
$("#input_import_file").change(function() {
- matchFile($(this).attr("value"));
+ matchFile($(this).val());
});
$("#select_local_import_file").change(function() {
- matchFile($(this).attr("value"));
+ matchFile($(this).val());
});
/*
@@ -66,12 +66,12 @@ $(document).ready(function() {
* form is clicked, the radio button beside it becomes selected and the other form becomes disabled.
*/
$("#input_import_file").focus(function() {
- $("#radio_import_file").attr('checked', 'checked');
- $("#radio_local_import_file").removeAttr('checked');
+ $("#radio_import_file").prop('checked', true);
+ $("#radio_local_import_file").removeProp('checked');
});
$("#select_local_import_file").focus(function() {
- $("#radio_local_import_file").attr('checked', 'checked');
- $("#radio_import_file").removeAttr('checked');
+ $("#radio_local_import_file").prop('checked', true);
+ $("#radio_import_file").removeProp('checked');
});
/**
diff --git a/js/indexes.js b/js/indexes.js
index 8099056913..af6c990729 100644
--- a/js/indexes.js
+++ b/js/indexes.js
@@ -36,7 +36,7 @@ function checkIndexType()
$size_header.hide();
$size_inputs.each(function(){
$(this)
- .attr('disabled', true)
+ .prop('disabled', true)
.parent('td').hide();
});
@@ -46,7 +46,7 @@ function checkIndexType()
$column_input = $(this);
if (! initial) {
$column_input
- .attr('disabled', true)
+ .prop('disabled', true)
.parent('td').hide();
} else {
initial = false;
@@ -60,14 +60,14 @@ function checkIndexType()
$size_header.show();
$size_inputs.each(function() {
$(this)
- .attr('disabled', false)
+ .prop('disabled', false)
.parent('td').show();
});
// Enable and show the columns of the index
$column_inputs.each(function() {
$(this)
- .attr('disabled', false)
+ .prop('disabled', false)
.parent('td').show();
});
diff --git a/js/makegrid.js b/js/makegrid.js
index 8bd4aa95ac..1027dbf6bb 100644
--- a/js/makegrid.js
+++ b/js/makegrid.js
@@ -251,11 +251,11 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
var $firstRowCols = $(g.t).find('tr:first th.draggable:visible');
var $resizeHandles = $(g.cRsz).find('div').removeClass('condition');
$('.pma_table').find('thead th:first').removeClass('before-condition');
- for (var n = 0; n < $firstRowCols.length; n++) {
+ for (var n = 0, l = $firstRowCols.length; n < l; n++) {
var $col = $($firstRowCols[n]);
$($resizeHandles[n]).css('left', $col.position().left + $col.outerWidth(true))
.show();
- if ($($firstRowCols[n]).hasClass('condition')) {
+ if ($col.hasClass('condition')) {
$($resizeHandles[n]).addClass('condition');
if (n > 0) {
$($resizeHandles[n-1]).addClass('condition');
@@ -478,10 +478,10 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
.hide();
});
g.colVisib[n] = 0;
- $(g.cList).find('.lDiv div:eq(' + n + ') input').removeAttr('checked');
+ $(g.cList).find('.lDiv div:eq(' + n + ') input').removeProp('checked');
} else {
// cannot hide, force the checkbox to stay checked
- $(g.cList).find('.lDiv div:eq(' + n + ') input').attr('checked', 'checked');
+ $(g.cList).find('.lDiv div:eq(' + n + ') input').prop('checked', true);
return false;
}
} else { // column n is not visible
@@ -491,7 +491,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
.show();
});
g.colVisib[n] = 1;
- $(g.cList).find('.lDiv div:eq(' + n + ') input').attr('checked', 'checked');
+ $(g.cList).find('.lDiv div:eq(' + n + ') input').prop('checked', true);
}
return true;
},
@@ -600,7 +600,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
g.currentEditCell = cell;
$(g.cEdit).find('.edit_box').focus();
- $(g.cEdit).find('*').removeAttr('disabled');
+ $(g.cEdit).find('*').removeProp('disabled');
}
}
},
@@ -748,44 +748,44 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
var $checkbox = $editArea.find('.null_div input');
// check if current is NULL
if ($td.is('.null')) {
- $checkbox.attr('checked', true);
+ $checkbox.prop('checked', true);
g.wasEditedCellNull = true;
}
// if the select/editor is changed un-check the 'checkbox_null__'.
if ($td.is('.enum, .set')) {
$editArea.find('select').live('change', function(e) {
- $checkbox.attr('checked', false);
+ $checkbox.prop('checked', false);
});
} else if ($td.is('.relation')) {
$editArea.find('select').live('change', function(e) {
- $checkbox.attr('checked', false);
+ $checkbox.prop('checked', false);
});
$editArea.find('.browse_foreign').live('click', function(e) {
- $checkbox.attr('checked', false);
+ $checkbox.prop('checked', false);
});
} else {
$(g.cEdit).find('.edit_box').live('keypress change', function(e) {
- $checkbox.attr('checked', false);
+ $checkbox.prop('checked', false);
});
$editArea.find('textarea').live('keydown', function(e) {
- $checkbox.attr('checked', false);
+ $checkbox.prop('checked', false);
});
}
// if null checkbox is clicked empty the corresponding select/editor.
$checkbox.click(function(e) {
if ($td.is('.enum')) {
- $editArea.find('select').attr('value', '');
+ $editArea.find('select').val('');
} else if ($td.is('.set')) {
$editArea.find('select').find('option').each(function() {
var $option = $(this);
- $option.attr('selected', false);
+ $option.prop('selected', false);
});
} else if ($td.is('.relation')) {
// if the dropdown is there to select the foreign value
if ($editArea.find('select').length > 0) {
- $editArea.find('select').attr('value', '');
+ $editArea.find('select').val('');
}
} else {
$editArea.find('textarea').val('');
@@ -974,7 +974,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
showTimepicker: showTimeOption,
onSelect: function(dateText, inst) {
// remove null checkbox if it exists
- $(g.cEdit).find('.null_div input[type=checkbox]').attr('checked', false);
+ $(g.cEdit).find('.null_div input[type=checkbox]').prop('checked', false);
}
});
@@ -1020,7 +1020,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
/**
* @var relational_display string 'K' if relational key, 'D' if relational display column
*/
- var relational_display = $("#relational_display_K").attr('checked') ? 'K' : 'D';
+ var relational_display = $("#relational_display_K").prop('checked') ? 'K' : 'D';
/**
* @var transform_fields Array containing the name/value pairs for transformed fields
*/
@@ -1044,7 +1044,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
/**
* @var where_clause Array containing where clause for updated fields
*/
- var full_where_clause = Array();
+ var full_where_clause = [];
/**
* @var is_unique Boolean, whether the rows in this table is unique or not
*/
@@ -1052,9 +1052,9 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
/**
* multi edit variables
*/
- var me_fields_name = Array();
- var me_fields = Array();
- var me_fields_null = Array();
+ var me_fields_name = [];
+ var me_fields = [];
+ var me_fields_null = [];
// alert user if edited table is not unique
if (!is_unique) {
@@ -1072,9 +1072,9 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
* multi edit variables, for current row
* @TODO array indices are still not correct, they should be md5 of field's name
*/
- var fields_name = Array();
- var fields = Array();
- var fields_null = Array();
+ var fields_name = [];
+ var fields = [];
+ var fields_null = [];
// loop each edited cell in a row
$tr.find('.to_be_saved').each(function() {
@@ -1181,12 +1181,11 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
};
if (!g.saveCellsAtOnce) {
- $(g.cEdit).find('*').attr('disabled', 'disabled');
- var $editArea = $(g.cEdit).find('.edit_area');
+ $(g.cEdit).find('*').prop('disabled', true);
$(g.cEdit).find('.edit_box').addClass('edit_box_posting');
} else {
$('.save_edited').addClass('saving_edited_data')
- .find('input').attr('disabled', 'disabled'); // disable the save button
+ .find('input').prop('disabled', true); // disable the save button
}
$.ajax({
@@ -1197,11 +1196,11 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
function(data) {
g.isSaving = false;
if (!g.saveCellsAtOnce) {
- $(g.cEdit).find('*').removeAttr('disabled');
+ $(g.cEdit).find('*').removeProp('disabled');
$(g.cEdit).find('.edit_box').removeClass('edit_box_posting');
} else {
$('.save_edited').removeClass('saving_edited_data')
- .find('input').removeAttr('disabled'); // enable the save button back
+ .find('input').removeProp('disabled'); // enable the save button back
}
if(data.success == true) {
PMA_ajaxShowMessage(data.message);
@@ -1209,11 +1208,11 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
$('.to_be_saved').parents('tr').each(function() {
var new_clause = $(this).data('new_clause');
var $where_clause = $(this).find('.where_clause');
- var old_clause = $where_clause.attr('value');
+ var old_clause = $where_clause.val();
var decoded_old_clause = PMA_urldecode(old_clause);
var decoded_new_clause = PMA_urldecode(new_clause);
- $where_clause.attr('value', new_clause);
+ $where_clause.val(new_clause);
// update Edit, Copy, and Delete links also
$(this).find('a').each(function() {
$(this).attr('href', $(this).attr('href').replace(old_clause, new_clause));
@@ -1231,10 +1230,10 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
$(this).find('input[type=checkbox]').each(function() {
var $checkbox = $(this);
var checkbox_name = $checkbox.attr('name');
- var checkbox_value = $checkbox.attr('value');
+ var checkbox_value = $checkbox.val();
$checkbox.attr('name', checkbox_name.replace(old_clause, new_clause));
- $checkbox.attr('value', checkbox_value.replace(decoded_old_clause, decoded_new_clause));
+ $checkbox.val(checkbox_value.replace(decoded_old_clause, decoded_new_clause));
});
});
// update the display of executed SQL query command
diff --git a/js/navigation.js b/js/navigation.js
index 337cb66173..e85bb21fa7 100644
--- a/js/navigation.js
+++ b/js/navigation.js
@@ -159,9 +159,9 @@ function PMA_setCookie(name, value, expires, path, domain, secure)
*/
function fast_filter(value)
{
- lowercase_value = value.toLowerCase();
- $("#subel0 a[class!='tableicon']").each(function(idx,elem){
- $elem = $(elem);
+ var lowercase_value = value.toLowerCase();
+ $("#subel0 a[class!='tableicon']").each(function(idx, elem) {
+ var $elem = $(elem);
// .indexOf is case sensitive so convert to lowercase to compare
if (value && $elem.html().toLowerCase().indexOf(lowercase_value) == -1) {
$elem.parent().hide();
diff --git a/js/querywindow.js b/js/querywindow.js
index 55c895a061..0eb1cc13a5 100644
--- a/js/querywindow.js
+++ b/js/querywindow.js
@@ -1,14 +1,16 @@
function PMA_queryAutoCommit()
{
- document.getElementById('sqlqueryform').target = window.opener.frame_content.name;
- document.getElementById('sqlqueryform').submit();
+ var sqlqueryform = document.getElementById('sqlqueryform');
+ sqlqueryform.target = window.opener.frame_content.name;
+ sqlqueryform.submit();
return;
}
function PMA_querywindowCommit(tab)
{
- $('#hiddenqueryform').find("input[name='querydisplay_tab']").attr("value" ,tab);
- $('#hiddenqueryform').submit();
+ var $hiddenqueryform = $('#hiddenqueryform');
+ $hiddenqueryform.find("input[name='querydisplay_tab']").val(tab);
+ $hiddenqueryform.submit();
return false;
}
@@ -19,23 +21,26 @@ function PMA_querywindowSetFocus()
function PMA_querywindowResize()
{
+ var $el = $(this)[0];
+ var $querywindowcontainer = $('#querywindowcontainer');
+
// for Gecko
- if (typeof($(this)[0].sizeToContent) == 'function') {
- $(this)[0].sizeToContent();
+ if (typeof($el.sizeToContent) == 'function') {
+ $el.sizeToContent();
//self.scrollbars.visible = false;
// give some more space ... to prevent 'fli(pp/ck)ing'
- $(this)[0].resizeBy(10, 50);
+ $el.resizeBy(10, 50);
return;
}
// for IE, Opera
- if ($('#querywindowcontainer') != 'undefined') {
+ if ($querywindowcontainer.length) {
// get content size
- var newWidth = $("#querywindowcontainer")[0].offsetWidth;
- var newHeight = $("#querywindowcontainer")[0].offsetHeight;
+ var newWidth = $querywindowcontainer.width();
+ var newHeight = $querywindowcontainer.height();
// set size to contentsize
// plus some offset for scrollbars, borders, statusbar, menus ...
- $(this)[0].resizeTo(newWidth + 45, newHeight + 75);
+ $el.resizeTo(newWidth + 45, newHeight + 75);
}
}
diff --git a/js/replication.js b/js/replication.js
index f3fdb1e931..2137217259 100644
--- a/js/replication.js
+++ b/js/replication.js
@@ -49,6 +49,6 @@ $(document).ready(function() {
$('#slave_synchronization_gui').toggle();
});
$('#db_reset_href').click(function() {
- $('#db_select option:selected').attr('selected', false);
+ $('#db_select option:selected').prop('selected', false);
});
});
diff --git a/js/server_privileges.js b/js/server_privileges.js
index 65feb11cf4..df67543dc9 100644
--- a/js/server_privileges.js
+++ b/js/server_privileges.js
@@ -172,7 +172,7 @@ $(document).ready(function() {
}
//We also need to post the value of the submit button in order to get this to work correctly
- $.post($form.attr('action'), $form.serialize() + "&adduser_submit=" + $(this).find("input[name=adduser_submit]").attr('value'), function(data) {
+ $.post($form.attr('action'), $form.serialize() + "&adduser_submit=" + $(this).find("input[name=adduser_submit]").val(), function(data) {
if (data.success == true) {
// Refresh navigation, if we created a database with the name
// that is the same as the username of the new user
@@ -204,7 +204,7 @@ $(document).ready(function() {
url = url + "&ajax_request=true&db_specific=true";
/* post request for get the updated userForm table */
- $.post($form.attr('action' ), url, function(priv_data) {
+ $.post($form.attr('action'), url, function(priv_data) {
/*Remove the old userForm table*/
if ($('#userFormDiv').length != 0) {
@@ -212,11 +212,11 @@ $(document).ready(function() {
} else {
$("#usersForm").remove();
}
- var user_div = $('
');
+ var $user_div = $('
');
/*If the JSON string parsed correctly*/
if (typeof priv_data.success != 'undefined') {
if (priv_data.success == true) {
- user_div
+ $user_div
.html(priv_data.user_form)
.insertAfter('#result_query');
} else {
@@ -225,7 +225,7 @@ $(document).ready(function() {
} else {
/*parse the JSON string*/
var obj = $.parseJSON(priv_data);
- user_div
+ $user_div
.html(obj.user_form)
.insertAfter('#result_query');
}
@@ -307,7 +307,7 @@ $(document).ready(function() {
$form = $("#usersForm");
- $.post($form.attr('action'), $form.serialize() + "&delete=" + $(this).attr('value') + "&ajax_request=true", function(data) {
+ $.post($form.attr('action'), $form.serialize() + "&delete=" + $(this).val() + "&ajax_request=true", function(data) {
if(data.success == true) {
PMA_ajaxShowMessage(data.message);
// Refresh navigation, if we droppped some databases with the name
@@ -399,19 +399,21 @@ $(document).ready(function() {
PMA_ajaxShowMessage(PMA_messages['strProcessingRequest']);
- $(this).append(' ');
+ var $t = $(this);
+
+ $t.append(' ');
/**
* @var curr_submit_name name of the current button being submitted
*/
- var curr_submit_name = $(this).find('.tblFooters').find('input:submit').attr('name');
+ var curr_submit_name = $t.find('.tblFooters').find('input:submit').attr('name');
/**
* @var curr_submit_value value of the current button being submitted
*/
- var curr_submit_value = $(this).find('.tblFooters').find('input:submit').val();
+ var curr_submit_value = $t.find('.tblFooters').find('input:submit').val();
- $.post($(this).attr('action'), $(this).serialize() + '&' + curr_submit_name + '=' + curr_submit_value, function(data) {
+ $.post($t.attr('action'), $t.serialize() + '&' + curr_submit_name + '=' + curr_submit_value, function(data) {
if(data.success == true) {
PMA_ajaxShowMessage(data.message);
@@ -425,9 +427,9 @@ $(document).ready(function() {
.remove()
.end()
.after(data.sql_query);
- var notice_class = $("#floating_menubar").next("div").find('.notice');
- if($(notice_class).text() == '') {
- $(notice_class).remove();
+ var $notice_class = $("#floating_menubar").next("div").find('.notice');
+ if($notice_class.text() == '') {
+ $notice_class.remove();
}
} //Show SQL Query that was executed
@@ -590,11 +592,11 @@ $(document).ready(function() {
* 'Drop the databases...'
*/
$('#checkbox_drop_users_db').click(function() {
- $this_checkbox = $(this);
+ var $this_checkbox = $(this);
if ($this_checkbox.is(':checked')) {
var is_confirmed = confirm(PMA_messages['strDropDatabaseStrongWarning'] + '\n' + PMA_messages['strDoYouReally'] + '\nDROP DATABASE');
if (! is_confirmed) {
- $this_checkbox.attr('checked', false);
+ $this_checkbox.prop('checked', false);
}
}
});
diff --git a/js/server_status.js b/js/server_status.js
index 4826ecc1c6..893fb34d0d 100644
--- a/js/server_status.js
+++ b/js/server_status.js
@@ -90,7 +90,7 @@ $(function() {
$(document).click( function(event) {
$('.openedPopup').each(function() {
var $cnt = $(this);
- var pos = $(this).offset();
+ var pos = $cnt.offset();
// Hide if the mouseclick is outside the popupcontent
if (event.pageX < pos.left
diff --git a/js/server_status_monitor.js b/js/server_status_monitor.js
index d0ec47a7de..f6e5e34e21 100644
--- a/js/server_status_monitor.js
+++ b/js/server_status_monitor.js
@@ -4,9 +4,17 @@ $(function() {
$('div#statustabs_charting img#loadingMonitorIcon').remove();
// Codemirror is loaded on demand so we might need to initialize it
if (! codemirror_editor) {
- var elm = $('#sqlquery');
- if (elm.length > 0 && typeof CodeMirror != 'undefined') {
- codemirror_editor = CodeMirror.fromTextArea(elm[0], { lineNumbers: true, matchBrackets: true, indentUnit: 4, mode: "text/x-mysql" });
+ var $elm = $('#sqlquery');
+ if ($elm.length > 0 && typeof CodeMirror != 'undefined') {
+ codemirror_editor = CodeMirror.fromTextArea(
+ $elm[0],
+ {
+ lineNumbers: true,
+ matchBrackets: true,
+ indentUnit: 4,
+ mode: "text/x-mysql"
+ }
+ );
}
}
// Timepicker is loaded on demand so we need to initialize datetime fields from the 'load log' dialog
@@ -443,7 +451,7 @@ $(function() {
}
}
- newChart.title = $('input[name="chartTitle"]').attr('value');
+ newChart.title = $('input[name="chartTitle"]').val();
// Add a cloned object to the chart grid
addChart($.extend(true, {}, newChart));
@@ -468,7 +476,7 @@ $(function() {
});
$presetList.change(function() {
$('input#chartPreset').trigger('click');
- $('input[name="chartTitle"]').attr('value', presetCharts[$(this).prop('value')].title);
+ $('input[name="chartTitle"]').val(presetCharts[$(this).val()].title);
});
}
@@ -729,13 +737,13 @@ $(function() {
$('input[name="chartType"]').change(function() {
$('#chartVariableSettings').toggle(this.checked && this.value == 'variable');
- var title = $('input[name="chartTitle"]').attr('value');
+ var title = $('input[name="chartTitle"]').val();
if (title == PMA_messages['strChartTitle']
|| title == $('label[for="' + $('input[name="chartTitle"]').data('lastRadio') + '"]').text()
) {
$('input[name="chartTitle"]')
.data('lastRadio', $(this).attr('id'))
- .attr('value', $('label[for="' + $(this).attr('id') + '"]').text());
+ .val($('label[for="' + $(this).attr('id') + '"]').text());
}
});
@@ -749,21 +757,21 @@ $(function() {
$('select[name="varChartList"]').change(function () {
if (this.selectedIndex != 0) {
- $('#variableInput').attr('value', this.value);
+ $('#variableInput').val(this.value);
}
});
$('a[href="#kibDivisor"]').click(function() {
- $('input[name="valueDivisor"]').attr('value', 1024);
- $('input[name="valueUnit"]').attr('value', PMA_messages['strKiB']);
+ $('input[name="valueDivisor"]').val(1024);
+ $('input[name="valueUnit"]').val(PMA_messages['strKiB']);
$('span.unitInput').toggle(true);
$('input[name="useUnit"]').prop('checked', true);
return false;
});
$('a[href="#mibDivisor"]').click(function() {
- $('input[name="valueDivisor"]').attr('value', 1024*1024);
- $('input[name="valueUnit"]').attr('value', PMA_messages['strMiB']);
+ $('input[name="valueDivisor"]').val(1024*1024);
+ $('input[name="valueUnit"]').val(PMA_messages['strMiB']);
$('span.unitInput').toggle(true);
$('input[name="useUnit"]').prop('checked', true);
return false;
@@ -776,7 +784,7 @@ $(function() {
});
$('a[href="#submitAddSeries"]').click(function() {
- if ($('input#variableInput').attr('value').length == 0) {
+ if ($('input#variableInput').val() == "") {
return false;
}
@@ -784,27 +792,27 @@ $(function() {
$('#seriesPreview').html('');
newChart = {
- title: $('input[name="chartTitle"]').attr('value'),
+ title: $('input[name="chartTitle"]').val(),
nodes: []
};
}
var serie = {
- dataPoints: [{ type: 'statusvar', name: $('input#variableInput').attr('value') }],
- name: $('input#variableInput').attr('value'),
- display: $('input[name="differentialValue"]').attr('checked') ? 'differential' : ''
+ dataPoints: [{ type: 'statusvar', name: $('input#variableInput').val() }],
+ name: $('input#variableInput').val(),
+ display: $('input[name="differentialValue"]').prop('checked') ? 'differential' : ''
};
if (serie.dataPoint == 'Processes') {
serie.dataType='proc';
}
- if ($('input[name="useDivisor"]').attr('checked')) {
- serie.valueDivisor = parseInt($('input[name="valueDivisor"]').attr('value'));
+ if ($('input[name="useDivisor"]').prop('checked')) {
+ serie.valueDivisor = parseInt($('input[name="valueDivisor"]').val());
}
- if ($('input[name="useUnit"]').attr('checked')) {
- serie.unit = $('input[name="valueUnit"]').attr('value');
+ if ($('input[name="useUnit"]').prop('checked')) {
+ serie.unit = $('input[name="valueUnit"]').val();
}
var str = serie.display == 'differential' ? ', ' + PMA_messages['strDifferential'] : '';
@@ -815,10 +823,10 @@ $(function() {
newChart.nodes.push(serie);
- $('input#variableInput').attr('value', '');
- $('input[name="differentialValue"]').attr('checked', true);
- $('input[name="useDivisor"]').attr('checked', false);
- $('input[name="useUnit"]').attr('checked', false);
+ $('input#variableInput').val('');
+ $('input[name="differentialValue"]').prop('checked', true);
+ $('input[name="useDivisor"]').prop('checked', false);
+ $('input[name="useUnit"]').prop('checked', false);
$('input[name="useDivisor"]').trigger('change');
$('input[name="useUnit"]').trigger('change');
$('select[name="varChartList"]').get(0).selectedIndex = 0;
@@ -849,7 +857,7 @@ $(function() {
$('a[href="#clearMonitorConfig"]').toggle(runtime.charts != null);
if (runtime.charts != null && monitorProtocolVersion != window.localStorage['monitorVersion']) {
- $('div#emptyDialog').attr('title',PMA_messages['strIncompatibleMonitorConfig']);
+ $('div#emptyDialog').attr('title', PMA_messages['strIncompatibleMonitorConfig']);
$('div#emptyDialog').html(PMA_messages['strIncompatibleMonitorConfigDescription']);
var dlgBtns = {};
@@ -869,8 +877,8 @@ $(function() {
monitorSettings = defaultMonitorSettings;
}
- $('select[name="gridChartRefresh"]').attr('value', monitorSettings.gridRefresh / 1000);
- $('select[name="chartColumns"]').attr('value', monitorSettings.columns);
+ $('select[name="gridChartRefresh"]').val(monitorSettings.gridRefresh / 1000);
+ $('select[name="chartColumns"]').val(monitorSettings.columns);
if (monitorSettings.gridMaxPoints == 'auto') {
runtime.gridMaxPoints = Math.round((monitorSettings.chartSize.width - 40) / 12);
@@ -945,9 +953,9 @@ $(function() {
if (runtime.charts) {
oldData = {};
$.each(runtime.charts, function(key, chartObj) {
- for (var i = 0; i < chartObj.nodes.length; i++) {
+ for (var i = 0, l = chartObj.nodes.length; i < l; i++) {
oldData[chartObj.nodes[i].dataPoint] = [];
- for (var j = 0; j < chartObj.chart.series[i].data.length; j++)
+ for (var j = 0, ll = chartObj.chart.series[i].data.length; j < ll; j++)
oldData[chartObj.nodes[i].dataPoint].push([chartObj.chart.series[i].data[j].x, chartObj.chart.series[i].data[j].y]);
}
});
@@ -958,7 +966,7 @@ $(function() {
if (oldData) {
$.each(runtime.charts, function(key, chartObj) {
- for (var j = 0; j < chartObj.nodes.length; j++) {
+ for (var j = 0, l = chartObj.nodes.length; j < l; j++) {
if (oldData[chartObj.nodes[j].dataPoint]) {
chartObj.chart.series[j].setData(oldData[chartObj.nodes[j].dataPoint]);
}
@@ -979,7 +987,7 @@ $(function() {
/* Adds a chart to the chart grid */
function addChart(chartObj, initialize) {
series = [];
- for (var j = 0; j Sum up identical columns, and hide all but 1
- q = $(this).text().replace(equalsFilter, '$1=...$6').trim();
+ q = $t.text().replace(equalsFilter, '$1=...$6').trim();
q = q.replace(functionFilter, ' $1(...)');
// Js does not specify a limit on property name length, so we can abuse it as index :-)
if (filteredQueries[q]) {
- filteredQueries[q] += parseInt($(this).next().text());
- totalSum += parseInt($(this).next().text());
+ filteredQueries[q] += parseInt($t.next().text());
+ totalSum += parseInt($t.next().text());
hide = true;
} else {
- filteredQueries[q] = parseInt($(this).next().text());;
+ filteredQueries[q] = parseInt($t.next().text());
filteredQueriesLines[q] = i;
- $(this).text(q);
+ $t.text(q);
}
if (isSlowLog) {
- countRow(q, $(this).parent().html());
+ countRow(q, $t.parent().html());
}
} else {
// Group off: Restore original columns
- rowData = $(this).parent().data('query');
+ rowData = $t.parent().data('query');
// Restore SQL text
- $(this).text(rowData[queryColumnName]);
+ $t.text(rowData[queryColumnName]);
// Restore total count
- $(this).next().text(rowData[sumColumnName]);
+ $t.next().text(rowData[sumColumnName]);
// Restore slow log columns
if (isSlowLog) {
- $(this).parent().children('td:nth-child(3)').text(rowData['query_time']);
- $(this).parent().children('td:nth-child(4)').text(rowData['lock_time']);
- $(this).parent().children('td:nth-child(5)').text(rowData['rows_sent']);
- $(this).parent().children('td:nth-child(6)').text(rowData['rows_examined']);
+ $t.parent().children('td:nth-child(3)').text(rowData['query_time']);
+ $t.parent().children('td:nth-child(4)').text(rowData['lock_time']);
+ $t.parent().children('td:nth-child(5)').text(rowData['rows_sent']);
+ $t.parent().children('td:nth-child(6)').text(rowData['rows_examined']);
}
}
}
// If not required to be hidden, do we need to hide because of a not matching text filter?
- if (! hide && (textFilter != null && ! textFilter.exec($(this).text()))) {
+ if (! hide && (textFilter != null && ! textFilter.exec($t.text()))) {
hide = true;
}
// Now display or hide this column
if (hide) {
- $(this).parent().css('display', 'none');
+ $t.parent().css('display', 'none');
} else {
- totalSum += parseInt($(this).next().text());
+ totalSum += parseInt($t.next().text());
rowSum++;
odd_row = ! odd_row;
- $(this).parent().css('display', '');
+ $t.parent().css('display', '');
if (odd_row) {
- $(this).parent().addClass('odd');
- $(this).parent().removeClass('even');
+ $t.parent().addClass('odd');
+ $t.parent().removeClass('even');
} else {
- $(this).parent().addClass('even');
- $(this).parent().removeClass('odd');
+ $t.parent().addClass('even');
+ $t.parent().removeClass('odd');
}
}
@@ -1593,9 +1604,9 @@ $(function() {
/* Turns a number into a timespan (100 into 00:01:40) */
function secToTime(timeInt) {
- hours = Math.floor(timeInt / 3600);
+ var hours = Math.floor(timeInt / 3600);
timeInt -= hours*3600;
- minutes = Math.floor(timeInt / 60);
+ var minutes = Math.floor(timeInt / 60);
timeInt -= minutes*60;
if (hours < 10) {
@@ -1628,7 +1639,7 @@ $(function() {
return value;
};
- for (var i = 0; i < rows.length; i++) {
+ for (var i = 0, l = rows.length; i < l; i++) {
if (i == 0) {
$.each(rows[0], function(key, value) {
cols.push(key);
@@ -1642,7 +1653,7 @@ $(function() {
$tBody.append($tRow = $(' '));
var cl = '';
- for (var j = 0; j < cols.length; j++) {
+ for (var j = 0, ll = cols.length; j < ll; j++) {
// Assuming the query column is the second last
if (j == cols.length - 2 && rows[i][cols[j]].match(/^SELECT/i)) {
$tRow.append($tCell = $('' + formatValue(cols[j], rows[i][cols[j]]) + ' '));
@@ -1766,7 +1777,7 @@ $(function() {
explain += ')';
}
explain += '
';
- for (var i = 0; i < data.explain.length; i++) {
+ for (var i = 0, l = data.explain.length; i < l; i++) {
explain += '0? 'style="display:none;"' : '' ) + '>';
$.each(data.explain[i], function(key, value) {
value = (value == null)?'null':value;
@@ -1797,7 +1808,7 @@ $(function() {
var numberTable = '
' + PMA_messages['strStatus'] + ' ' + PMA_messages['strTime'] + ' ';
var duration;
- for (var i = 0; i < data.profiling.length; i++) {
+ for (var i = 0, l = data.profiling.length; i < l; i++) {
duration = parseFloat(data.profiling[i].duration);
chartData.push([data.profiling[i].state, duration]);
diff --git a/js/server_synchronize.js b/js/server_synchronize.js
index 4a4b1c1288..0c2adc4890 100644
--- a/js/server_synchronize.js
+++ b/js/server_synchronize.js
@@ -63,7 +63,7 @@ function showDetails(i, update_size, insert_size, remove_size, insert_index, rem
newRow.setAttribute("class", row_class);
newRow.className = row_class;
// Id assigned to this row element is same as the index of this table name in the matching_tables/source_tables_uncommon array
- newRow.setAttribute("id" , i);
+ newRow.setAttribute("id", i);
var table_name_cell = document.createElement("td");
table_name_cell.align = "center";
@@ -207,10 +207,10 @@ function showDetails(i, update_size, insert_size, remove_size, insert_index, rem
{
row_class_element = table_rows[index].getAttribute('class');
if (row_class_element == "even") {
- table_rows[index].setAttribute("class","odd"); // for Mozilla firefox
+ table_rows[index].setAttribute("class", "odd"); // for Mozilla firefox
table_rows[index].className = "odd"; // for IE browser
} else {
- table_rows[index].setAttribute("class","even"); // for Mozilla firefox
+ table_rows[index].setAttribute("class", "even"); // for Mozilla firefox
table_rows[index].className = "even"; // for IE browser
}
}
diff --git a/js/server_variables.js b/js/server_variables.js
index ef453f02d4..691e6677b9 100644
--- a/js/server_variables.js
+++ b/js/server_variables.js
@@ -39,7 +39,7 @@ $(function() {
var name = location.hash.substr(1).split('=')[1];
// Only allow variable names
if (! name.match(/[^0-9a-zA-Z_]+/)) {
- $('#filterText').attr('value',name).trigger('keyup');
+ $('#filterText').val(name).trigger('keyup');
}
}
@@ -141,7 +141,7 @@ function editVariable(link)
ajax_request: true,
type: 'setval',
varName: varName,
- varValue: $cell.find('input').attr('value')
+ varValue: $cell.find('input').val()
}, function(data) {
if (data.success) {
$cell.html(data.variable);
diff --git a/js/sql.js b/js/sql.js
index 6f00c75b0b..252b2fa7f1 100644
--- a/js/sql.js
+++ b/js/sql.js
@@ -76,7 +76,7 @@ $(document).ready(function() {
$('input#bkm_label').keyup(function() {
$('input#id_bkm_all_users, input#id_bkm_replace')
.parent()
- .toggle($(this).attr('value').length > 0);
+ .toggle($(this).val().length > 0);
}).trigger('keyup');
/**
@@ -133,7 +133,7 @@ $(document).ready(function() {
// instead of the one related to Bookmarks, so empty the
// id_bookmark selector to avoid misinterpretation in
// import.php about what needs to be done
- $form.find("select[name=id_bookmark]").attr("value","");
+ $form.find("select[name=id_bookmark]").val("");
// let normal event propagation happen
});
@@ -371,7 +371,7 @@ $(document).ready(function() {
/*Check whether atleast one row is selected for change*/
if ($("#table_results tbody tr, #table_results tbody tr td").hasClass("marked")) {
- var div = $('
');
+ var $div = $('
');
/**
* @var button_options Object that stores the options passed to jQueryUI
@@ -386,10 +386,10 @@ $(document).ready(function() {
var $form = $("#resultsForm");
var $msgbox = PMA_ajaxShowMessage();
- $.get( $form.attr('action'), $form.serialize()+"&ajax_request=true&submit_mult=row_edit", function(data) {
+ $.get($form.attr('action'), $form.serialize()+"&ajax_request=true&submit_mult=row_edit", function(data) {
//in the case of an error, show the error message returned.
if (data.success != undefined && data.success == false) {
- div
+ $div
.append(data.error)
.dialog({
title: PMA_messages['strChangeTbl'],
@@ -402,7 +402,7 @@ $(document).ready(function() {
buttons : button_options_error
}); // end dialog options
} else {
- div
+ $div
.append(data)
.dialog({
title: PMA_messages['strChangeTbl'],
@@ -476,9 +476,8 @@ $(document).ready(function() {
* @var the_form object referring to the insert form
*/
var $form = $("#insertForm");
- /**Get the submit type and the after insert type in the form*/
- var selected_submit_type = $("#insertForm").find("#actions_panel .control_at_footer option:selected").attr('value');
- var selected_after_insert = $("#insertForm").find("#actions_panel select[name=after_insert] option:selected").attr('value');
+ /**Get the submit type in the form*/
+ var selected_submit_type = $("#insertForm").find("#actions_panel .control_at_footer option:selected").val();
$("#result_query").remove();
PMA_prepareForAjaxRequest($form);
//User wants to submit the form
diff --git a/js/tbl_change.js b/js/tbl_change.js
index d70662ea8e..d90a59833e 100644
--- a/js/tbl_change.js
+++ b/js/tbl_change.js
@@ -138,17 +138,15 @@ function isDate(val,tmstmp)
*/
function isTime(val)
{
- var arrayVal=val.split(":");
- for(var a=0;a 0) {
- var pmaThemeImage = $('#pmaThemeImage').attr('value');
+ var pmaThemeImage = $('#pmaThemeImage').val();
// add panning arrows
$(' ').appendTo($placeholder);
$(' ').appendTo($placeholder);
diff --git a/js/tbl_select.js b/js/tbl_select.js
index f782bf50da..87dee553a0 100644
--- a/js/tbl_select.js
+++ b/js/tbl_select.js
@@ -130,9 +130,9 @@ $(document).ready(function() {
// If the chosen function takes two geomerty objects as parameters
var $operator = $geomFuncSelector.parents('tr').find('td:nth-child(5)').find('select');
if ($.inArray($geomFuncSelector.val(), binaryFunctions) >= 0){
- $operator.attr('readonly', true);
+ $operator.prop('readonly', true);
} else {
- $operator.attr('readonly', false);
+ $operator.prop('readonly', false);
}
// if the chosen function's output is a geometry, enable GIS editor
diff --git a/js/tbl_structure.js b/js/tbl_structure.js
index 2bf841cf24..0ed60353c6 100644
--- a/js/tbl_structure.js
+++ b/js/tbl_structure.js
@@ -228,7 +228,7 @@ $(document).ready(function() {
// Edit index
var url = $(this).find("a").attr("href");
if (url.substring(0, 16) == "tbl_indexes.php?") {
- url = url.substring(16, url.length );
+ url = url.substring(16, url.length);
}
var title = PMA_messages['strEditIndex'];
}
@@ -395,7 +395,7 @@ $(document).ready(function() {
};
var $msgbox = PMA_ajaxShowMessage();
- $.get( $form.attr('action') , $form.serialize()+"&ajax_request=true" , function(data) {
+ $.get($form.attr('action') , $form.serialize()+"&ajax_request=true" , function(data) {
//in the case of an error, show the error message returned.
if (data.success != undefined && data.success == false) {
$div
diff --git a/js/tbl_zoom_plot.js b/js/tbl_zoom_plot.js
index c7b6968e00..93728c7844 100644
--- a/js/tbl_zoom_plot.js
+++ b/js/tbl_zoom_plot.js
@@ -175,8 +175,6 @@ $(document).ready(function() {
var xType = $('#types_0').val();
var yType = $('#types_1').val();
var dataLabel = $('#dataLabel').val();
- var lastX;
- var lastY;
var zoomRatio = 1;
@@ -316,9 +314,11 @@ $(document).ready(function() {
var it = 4;
var xChange = false;
var yChange = false;
+ var key;
+
for (key in selectedRow) {
var oldVal = selectedRow[key];
- var newVal = ($('#fields_null_id_' + it).attr('checked')) ? null : $('#fieldID_' + it).val();
+ var newVal = ($('#fields_null_id_' + it).prop('checked')) ? null : $('#fieldID_' + it).val();
if (newVal instanceof Array) { // when the column is of type SET
newVal = $('#fieldID_' + it).map(function(){
return $(this).val();
@@ -598,15 +598,15 @@ $(document).ready(function() {
};
$.post('tbl_zoom_select.php', post_params, function(data) {
// Row is contained in data.row_info, now fill the displayResultForm with row values
- for (key in data.row_info) {
+ for (var key in data.row_info) {
$field = $('#fieldID_' + fid);
$field_null = $('#fields_null_id_' + fid);
if (data.row_info[key] == null) {
- $field_null.attr('checked', true);
+ $field_null.prop('checked', true);
$field.val('');
} else {
- $field_null.attr('checked', false);
- if ($field.attr('multiple')) { // when the column is of type SET
+ $field_null.prop('checked', false);
+ if ($field.prop('multiple')) { // when the column is of type SET
$field.val(data.row_info[key].split(','));
} else {
$field.val(data.row_info[key]);