From 8bdca339f68187779c4987a63568bd934cc67848 Mon Sep 17 00:00:00 2001 From: Gemorroj Date: Sat, 7 Apr 2012 14:27:28 +0300 Subject: [PATCH] Better compatibility with newer versions of jQuery. Method of "attr" changed to "prop", method of "removeAttr" changed to "removeProp", attr("value" is replaced by the method of "val". --- js/db_operations.js | 3 +- js/db_structure.js | 12 ++-- js/export.js | 66 ++++++++--------- js/functions.js | 104 +++++++++++++-------------- js/gis_data_editor.js | 20 +++--- js/import.js | 18 ++--- js/indexes.js | 8 +-- js/makegrid.js | 46 ++++++------ js/querywindow.js | 27 ++++--- js/replication.js | 2 +- js/server_privileges.js | 8 +-- js/server_status_monitor.js | 137 ++++++++++++++++++------------------ js/server_synchronize.js | 6 +- js/server_variables.js | 4 +- js/sql.js | 11 ++- js/tbl_change.js | 11 +-- js/tbl_chart.js | 26 +++---- js/tbl_gis_visualization.js | 2 +- js/tbl_select.js | 4 +- js/tbl_structure.js | 2 +- js/tbl_zoom_plot.js | 8 +-- 21 files changed, 266 insertions(+), 259 deletions(-) diff --git a/js/db_operations.js b/js/db_operations.js index 9cc55810fd..2adbc02cad 100644 --- a/js/db_operations.js +++ b/js/db_operations.js @@ -133,8 +133,7 @@ $(document).ready(function() { PMA_prepareForAjaxRequest($form); PMA_ajaxShowMessage(PMA_messages['strChangingCharset']); - - $.get($form.attr('action'), $form.serialize() + "&submitcollation=" + $form.find("input[name=submitcollation]").attr('value'), function(data) { + $.get($form.attr('action'), $form.serialize() + "&submitcollation=" + $form.find("input[name=submitcollation]").val(), function(data) { if(data.success == true) { PMA_ajaxShowMessage(data.message); } diff --git a/js/db_structure.js b/js/db_structure.js index 5e205ed2af..827c0df0f9 100644 --- a/js/db_structure.js +++ b/js/db_structure.js @@ -223,8 +223,8 @@ $(document).ready(function() { */ 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'); + var selected_submit_type = $("#insertForm").find("#actions_panel .control_at_footer option:selected").val(); + var selected_after_insert = $("#insertForm").find("#actions_panel select[name=after_insert] option:selected").val(); $("#result_query").remove(); PMA_prepareForAjaxRequest($form); //User wants to submit the form @@ -258,17 +258,17 @@ $(document).ready(function() { * in the drop table confirmation form */ $(".fkc_switch").click(function(event){ - if ($("#fkc_checkbox").attr('checked') == 'checked') { - $("#fkc_checkbox").removeAttr('checked'); + if ($("#fkc_checkbox").prop('checked')) { + $("#fkc_checkbox").removeProp('checked'); $("#fkc_status").html(PMA_messages['strForeignKeyCheckDisabled']); return; } - $("#fkc_checkbox").attr('checked','checked'); + $("#fkc_checkbox").prop('checked', true); $("#fkc_status").html(PMA_messages['strForeignKeyCheckEnabled']); }); $('#fkc_checkbox').change(function () { - if ($(this).attr("checked")) { + if ($(this).prop("checked")) { $("#fkc_status").html(PMA_messages['strForeignKeyCheckEnabled']); return; } diff --git a/js/export.js b/js/export.js index a356d4526c..1b94c7283e 100644 --- a/js/export.js +++ b/js/export.js @@ -13,7 +13,7 @@ $(".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").show(); }); }); @@ -23,23 +23,23 @@ */ $(document).ready(function() { $("input[type='radio'][name$='sql_structure_or_data']").change(function() { - var show = $("input[type='radio'][name$='sql_structure_or_data']:checked").attr("value"); + var show = $("input[type='radio'][name$='sql_structure_or_data']:checked").val(); if(show == 'data') { // disable the SQL comment options $("#checkbox_sql_dates").parent().fadeTo('fast', 0.4); - $("#checkbox_sql_dates").attr('disabled', 'disabled'); + $("#checkbox_sql_dates").prop('disabled', true); $("#checkbox_sql_relation").parent().fadeTo('fast', 0.4); - $("#checkbox_sql_relation").attr('disabled', 'disabled'); + $("#checkbox_sql_relation").prop('disabled', true); $("#checkbox_sql_mime").parent().fadeTo('fast', 0.4); - $("#checkbox_sql_mime").attr('disabled', 'disabled'); + $("#checkbox_sql_mime").prop('disabled', true); } else { // enable the SQL comment options $("#checkbox_sql_dates").parent().fadeTo('fast', 1); - $("#checkbox_sql_dates").removeAttr('disabled'); + $("#checkbox_sql_dates").removeProp('disabled'); $("#checkbox_sql_relation").parent().fadeTo('fast', 1); - $("#checkbox_sql_relation").removeAttr('disabled'); + $("#checkbox_sql_relation").removeProp('disabled'); $("#checkbox_sql_mime").parent().fadeTo('fast', 1); - $("#checkbox_sql_mime").removeAttr('disabled'); + $("#checkbox_sql_mime").removeProp('disabled'); } }); }); @@ -55,7 +55,7 @@ function toggle_structure_data_opts(pluginName) var radioFormName = pluginName + "_structure_or_data"; var dataDiv = "#" + pluginName + "_data"; var structureDiv = "#" + pluginName + "_structure"; - var show = $("input[type='radio'][name='" + radioFormName + "']:checked").attr("value"); + var show = $("input[type='radio'][name='" + radioFormName + "']:checked").val(); if(show == 'data') { $(dataDiv).slideDown('slow'); $(structureDiv).slideUp('slow'); @@ -94,12 +94,12 @@ function toggle_save_to_file() { if($("#radio_dump_asfile:checked").length == 0) { $("#ul_save_asfile > li").fadeTo('fast', 0.4); - $("#ul_save_asfile > li > input").attr('disabled', 'disabled'); - $("#ul_save_asfile > li> select").attr('disabled', 'disabled'); + $("#ul_save_asfile > li > input").prop('disabled', true); + $("#ul_save_asfile > li> select").prop('disabled', true); } else { $("#ul_save_asfile > li").fadeTo('fast', 1); - $("#ul_save_asfile > li > input").removeAttr('disabled'); - $("#ul_save_asfile > li> select").removeAttr('disabled'); + $("#ul_save_asfile > li > input").removeProp('disabled'); + $("#ul_save_asfile > li> select").removeProp('disabled'); } } @@ -118,15 +118,15 @@ function toggle_sql_include_comments() $("#checkbox_sql_include_comments").change(function() { if($("#checkbox_sql_include_comments:checked").length == 0) { $("#ul_include_comments > li").fadeTo('fast', 0.4); - $("#ul_include_comments > li > input").attr('disabled', 'disabled'); + $("#ul_include_comments > li > input").prop('disabled', true); } else { // If structure is not being exported, the comment options for structure should not be enabled if($("#radio_sql_structure_or_data_data:checked").length == 1) { $("#text_sql_header_comment").parent("li").fadeTo('fast', 1); - $("#text_sql_header_comment").removeAttr('disabled'); + $("#text_sql_header_comment").removeProp('disabled'); } else { $("#ul_include_comments > li").fadeTo('fast', 1); - $("#ul_include_comments > li > input").removeAttr('disabled'); + $("#ul_include_comments > li > input").removeProp('disabled'); } } }); @@ -138,11 +138,11 @@ function toggle_sql_include_comments() $(document).ready(function() { $("#checkbox_sql_create_table_statements").change(function() { if($("#checkbox_sql_create_table_statements:checked").length == 0) { - $("#checkbox_sql_if_not_exists").removeAttr('checked'); - $("#checkbox_sql_auto_increment").removeAttr('checked'); + $("#checkbox_sql_if_not_exists").removeProp('checked'); + $("#checkbox_sql_auto_increment").removeProp('checked'); } else { - $("#checkbox_sql_if_not_exists").attr('checked', 'checked'); - $("#checkbox_sql_auto_increment").attr('checked', 'checked'); + $("#checkbox_sql_if_not_exists").prop('checked', true); + $("#checkbox_sql_auto_increment").prop('checked', true); } }); }); @@ -152,13 +152,13 @@ $(document).ready(function() { */ $(document).ready(function() { $("#plugins").change(function() { - var active_plugin = $("#plugins option:selected").attr("value"); - var force_file = $("#force_file_" + active_plugin).attr("value"); + var active_plugin = $("#plugins option:selected").val(); + var force_file = $("#force_file_" + active_plugin).val(); if(force_file == "true") { - $("#radio_view_as_text").attr('disabled', 'disabled'); + $("#radio_view_as_text").prop('disabled', true); $("#radio_view_as_text").parent().fadeTo('fast', 0.4); } else { - $("#radio_view_as_text").removeAttr('disabled'); + $("#radio_view_as_text").removeProp('disabled'); $("#radio_view_as_text").parent().fadeTo('fast', 1); } }); @@ -169,13 +169,13 @@ $(document).ready(function() { */ function toggle_quick_or_custom() { - if($("$(this):checked").attr("value") == "custom") { + if($("$(this):checked").val() == "custom") { $("#databases_and_tables").show(); $("#rows").show(); $("#output").show(); $("#format_specific_opts").show(); $("#output_quick_export").hide(); - var selected_plugin_name = $("#plugins option:selected").attr("value"); + var selected_plugin_name = $("#plugins option:selected").val(); $("#" + selected_plugin_name + "_options").show(); } else { $("#databases_and_tables").hide(); @@ -197,7 +197,7 @@ $(document).ready(function() { * Javascript-disabled browsers */ $(document).ready(function() { - if($("input[type='hidden'][name='export_method']").attr("value") != "custom-no-form") { + if($("input[type='hidden'][name='export_method']").val() != "custom-no-form") { $("#quick_or_custom").show(); } $("#scroll_to_options_msg").hide(); @@ -205,7 +205,7 @@ $(document).ready(function() { $(".format_specific_options").css({ "border": 0, "margin": 0, "padding": 0}); $(".format_specific_options h3").remove(); toggle_quick_or_custom(); - toggle_structure_data_opts($("select[id='plugins']").attr("value")); + toggle_structure_data_opts($("select[id='plugins']").val()); toggle_sql_include_comments(); }); @@ -214,16 +214,16 @@ $(document).ready(function() { */ $(document).ready(function() { $("input[type='radio'][name='allrows']").change(function() { - if($("input[type='radio'][name='allrows']:checked").attr("value") == "1") { + if($("input[type='radio'][name='allrows']:checked").val() == "1") { $("label[for='limit_to']").fadeTo('fast', 0.4); $("label[for='limit_from']").fadeTo('fast', 0.4); - $("input[type='text'][name='limit_to']").attr('disabled', 'disabled'); - $("input[type='text'][name='limit_from']").attr('disabled', 'disabled'); + $("input[type='text'][name='limit_to']").prop('disabled', true); + $("input[type='text'][name='limit_from']").prop('disabled', true); } else { $("label[for='limit_to']").fadeTo('fast', 1); $("label[for='limit_from']").fadeTo('fast', 1); - $("input[type='text'][name='limit_to']").removeAttr('disabled'); - $("input[type='text'][name='limit_from']").removeAttr('disabled'); + $("input[type='text'][name='limit_to']").removeProp('disabled'); + $("input[type='text'][name='limit_from']").removeProp('disabled'); } }); }); diff --git a/js/functions.js b/js/functions.js index d9c50219a3..d82a71d2f9 100644 --- a/js/functions.js +++ b/js/functions.js @@ -541,10 +541,10 @@ $(document).ready(function() { var $checkbox = $tr.find(':checkbox'); if ($checkbox.length) { // checkbox in a row, add or remove class depending on checkbox state - var checked = $checkbox.attr('checked'); + var checked = $checkbox.prop('checked'); if (!$(e.target).is(':checkbox, label')) { checked = !checked; - $checkbox.attr('checked', checked); + $checkbox.prop('checked', checked); } if (checked) { $tr.addClass('marked'); @@ -579,7 +579,7 @@ $(document).ready(function() { .slice(start, end + 1) .removeClass('marked') .find(':checkbox') - .attr('checked', false); + .prop('checked', false); } // handle new shift click @@ -595,7 +595,7 @@ $(document).ready(function() { .slice(start, end + 1) .addClass('marked') .find(':checkbox') - .attr('checked', true); + .prop('checked', true); // remember the last shift clicked row last_shift_clicked_row = curr_row; @@ -655,7 +655,7 @@ var marked_row = new Array; function markAllRows( container_id ) { - $("#"+container_id).find("input:checkbox:enabled").attr('checked', 'checked') + $("#"+container_id).find("input:checkbox:enabled").prop('checked', true) .parents("tr").addClass("marked"); return true; } @@ -669,7 +669,7 @@ function markAllRows( container_id ) function unMarkAllRows( container_id ) { - $("#"+container_id).find("input:checkbox:enabled").removeAttr('checked') + $("#"+container_id).find("input:checkbox:enabled").removeProp('checked') .parents("tr").removeClass("marked"); return true; } @@ -685,10 +685,10 @@ function setCheckboxes( container_id, state ) { if (state) { - $("#"+container_id).find("input:checkbox").attr('checked', 'checked'); + $("#"+container_id).find("input:checkbox").prop('checked', true); } else { - $("#"+container_id).find("input:checkbox").removeAttr('checked'); + $("#"+container_id).find("input:checkbox").removeProp('checked'); } return true; @@ -705,7 +705,7 @@ function setCheckboxes( container_id, state ) */ function setSelectOptions(the_form, the_select, do_check) { - $("form[name='"+ the_form +"'] select[name='"+the_select+"']").find("option").attr('selected', do_check); + $("form[name='"+ the_form +"'] select[name='"+the_select+"']").find("option").prop('selected', do_check); return true; } // end of the 'setSelectOptions()' function @@ -1110,39 +1110,38 @@ $(document).ready(function() { $("#export_type").change(function() { if ($("#export_type").val()=='svg') { - $("#show_grid_opt").attr("disabled","disabled"); - $("#orientation_opt").attr("disabled","disabled"); - $("#with_doc").attr("disabled","disabled"); - $("#show_table_dim_opt").removeAttr("disabled"); - $("#all_table_same_wide").removeAttr("disabled"); - $("#paper_opt").removeAttr("disabled","disabled"); - $("#show_color_opt").removeAttr("disabled","disabled"); + $("#show_grid_opt").prop("disabled",true); + $("#orientation_opt").prop("disabled",true); + $("#with_doc").prop("disabled",true); + $("#show_table_dim_opt").removeProp("disabled"); + $("#all_table_same_wide").removeProp("disabled"); + $("#paper_opt").removeProp("disabled"); + $("#show_color_opt").removeProp("disabled"); //$(this).css("background-color","yellow"); } else if ($("#export_type").val()=='dia') { - $("#show_grid_opt").attr("disabled","disabled"); - $("#with_doc").attr("disabled","disabled"); - $("#show_table_dim_opt").attr("disabled","disabled"); - $("#all_table_same_wide").attr("disabled","disabled"); - $("#paper_opt").removeAttr("disabled","disabled"); - $("#show_color_opt").removeAttr("disabled","disabled"); - $("#orientation_opt").removeAttr("disabled","disabled"); + $("#show_grid_opt").prop("disabled",true); + $("#with_doc").prop("disabled",true); + $("#show_table_dim_opt").prop("disabled",true); + $("#all_table_same_wide").prop("disabled",true); + $("#paper_opt").removeProp("disabled"); + $("#show_color_opt").removeProp("disabled"); + $("#orientation_opt").removeProp("disabled"); } else if ($("#export_type").val()=='eps') { - $("#show_grid_opt").attr("disabled","disabled"); - $("#orientation_opt").removeAttr("disabled"); - $("#with_doc").attr("disabled","disabled"); - $("#show_table_dim_opt").attr("disabled","disabled"); - $("#all_table_same_wide").attr("disabled","disabled"); - $("#paper_opt").attr("disabled","disabled"); - $("#show_color_opt").attr("disabled","disabled"); - + $("#show_grid_opt").prop("disabled",true); + $("#orientation_opt").removeProp("disabled"); + $("#with_doc").prop("disabled",true); + $("#show_table_dim_opt").prop("disabled",true); + $("#all_table_same_wide").prop("disabled",true); + $("#paper_opt").prop("disabled",true); + $("#show_color_opt").prop("disabled",true); } else if ($("#export_type").val()=='pdf') { - $("#show_grid_opt").removeAttr("disabled"); - $("#orientation_opt").removeAttr("disabled"); - $("#with_doc").removeAttr("disabled","disabled"); - $("#show_table_dim_opt").removeAttr("disabled","disabled"); - $("#all_table_same_wide").removeAttr("disabled","disabled"); - $("#paper_opt").removeAttr("disabled","disabled"); - $("#show_color_opt").removeAttr("disabled","disabled"); + $("#show_grid_opt").removeProp("disabled"); + $("#orientation_opt").removeProp("disabled"); + $("#with_doc").removeProp("disabled"); + $("#show_table_dim_opt").removeProp("disabled"); + $("#all_table_same_wide").removeProp("disabled"); + $("#paper_opt").removeProp("disabled"); + $("#show_color_opt").removeProp("disabled"); } else { // nothing } @@ -2193,7 +2192,7 @@ $(document).ready(function() { $("#copyTable.ajax input[name='submit_copy']").live('click', function(event) { event.preventDefault(); var $form = $("#copyTable"); - if ($form.find("input[name='switch_to_new']").attr('checked')) { + if ($form.find("input[name='switch_to_new']").prop('checked')) { $form.append(''); $form.removeClass('ajax'); $form.find("#ajax_request_hidden").remove(); @@ -2214,7 +2213,7 @@ $(document).ready(function() { $("#sqlqueryresults").html(data.sql_query); $("#result_query .notice").remove(); $("#result_query").prepend((data.message)); - $("#copyTable").find("select[name='target_db'] option").filterByValue(data.db).attr('selected', 'selected'); + $("#copyTable").find("select[name='target_db'] option").filterByValue(data.db).prop('selected', true); //Refresh navigation frame when the table is coppied if (window.parent && window.parent.frame_navigation) { @@ -2473,7 +2472,7 @@ function PMA_hideShowDefaultValue($default_type) $default_type.siblings('.default_value').hide(); if ($default_type.val() == 'NULL') { var $null_checkbox = $default_type.closest('tr').find('.allow_null'); - $null_checkbox.attr('checked', true); + $null_checkbox.prop('checked', true); } } } @@ -2483,7 +2482,7 @@ function PMA_hideShowDefaultValue($default_type) */ function PMA_validateDefaultValue($null_checkbox) { - if (! $null_checkbox.attr('checked')) { + if (! $null_checkbox.prop('checked')) { $default = $null_checkbox.closest('tr').find('.default_type'); if ($default.val() == 'NULL') { $default.val('NONE'); @@ -2600,8 +2599,8 @@ $(document).ready(function() { value_array.push("'" + val + "'"); }); // get the Length/Values text field where this value belongs - var values_id = $(this).find("input[type='hidden']").attr("value"); - $("input#" + values_id).attr("value", value_array.join(",")); + var values_id = $(this).find("input[type='hidden']").val(); + $("input#" + values_id).val(value_array.join(",")); $(this).dialog("close"); }; buttonOptions[PMA_messages['strClose']] = function () { @@ -2772,7 +2771,7 @@ function checkIndexName(form_id) // Index is a primary key if ($the_idx_type.find("option:selected").val() == 'PRIMARY') { $the_idx_name.val('PRIMARY'); - $the_idx_name.attr("disabled", true); + $the_idx_name.prop("disabled", true); } // Other cases @@ -2780,7 +2779,7 @@ function checkIndexName(form_id) if ($the_idx_name.val() == 'PRIMARY') { $the_idx_name.val(""); } - $the_idx_name.attr("disabled", false); + $the_idx_name.prop("disabled", false); } return true; @@ -3175,10 +3174,10 @@ $(document).ready(function() { var $checkbox = $('.vmarker').filter('.row_' + row_num + ':first').find(':checkbox'); if ($checkbox.length) { // checkbox in a row, add or remove class depending on checkbox state - var checked = $checkbox.attr('checked'); + var checked = $checkbox.prop('checked'); if (!$(e.target).is(':checkbox, label')) { checked = !checked; - $checkbox.attr('checked', checked); + $checkbox.prop('checked', checked); } // for all td of the same vertical row, toggle the marked class if (checked) { @@ -3446,7 +3445,7 @@ $(document).ready(function() { if ($.browser.msie || $.browser.safari) $(this).unbind('selectstart'); else if ($.browser.mozilla) $(this).css('MozUserSelect', 'inherit'); else if ($.browser.opera) $(this).unbind('mousedown'); - else $(this).removeAttr('unselectable', 'on'); + else $(this).removeAttr('unselectable'); }); } }; //end noSelect @@ -3521,12 +3520,13 @@ function PMA_getCellValue(td) { /* Loads a js file, an array may be passed as well */ loadJavascript=function(file) { + var head = $('head'); if ($.isArray(file)) { - for(var i=0; i'); + for(var i=0, l=file.length; i'); } } 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..73764fadcf 100644 --- a/js/makegrid.js +++ b/js/makegrid.js @@ -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 */ @@ -1181,12 +1181,12 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi }; if (!g.saveCellsAtOnce) { - $(g.cEdit).find('*').attr('disabled', 'disabled'); + $(g.cEdit).find('*').prop('disabled', true); var $editArea = $(g.cEdit).find('.edit_area'); $(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 +1197,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 +1209,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 +1231,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/querywindow.js b/js/querywindow.js index 55c895a061..8551fd5fd5 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..4eb7a4e434 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) { @@ -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 @@ -594,7 +594,7 @@ $(document).ready(function() { 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_monitor.js b/js/server_status_monitor.js index d0ec47a7de..cfaa88c1e5 100644 --- a/js/server_status_monitor.js +++ b/js/server_status_monitor.js @@ -443,7 +443,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 +468,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 +729,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 +749,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 +776,7 @@ $(function() { }); $('a[href="#submitAddSeries"]').click(function() { - if ($('input#variableInput').attr('value').length == 0) { + if ($('input#variableInput').val() == "") { return false; } @@ -784,27 +784,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 +815,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 +849,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 +869,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 +945,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 +958,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 +979,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 +1596,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 +1631,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 +1645,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 +1769,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 +1800,7 @@ $(function() { var numberTable = ''; 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..b6332beca8 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 }); @@ -386,7 +386,7 @@ $(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 @@ -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..e537c36189 100644 --- a/js/tbl_change.js +++ b/js/tbl_change.js @@ -157,10 +157,10 @@ function verificationsAfterFieldChange(urlField, multi_edit, theType) var target = evt.target || evt.srcElement; // Unchecks the corresponding "NULL" control - $("input[name='fields_null[multi_edit][" + multi_edit + "][" + urlField + "]']").attr('checked', false); + $("input[name='fields_null[multi_edit][" + multi_edit + "][" + urlField + "]']").prop('checked', false); // Unchecks the Ignore checkbox for the current row - $("input[name='insert_ignore_" + multi_edit + "']").attr('checked', false); + $("input[name='insert_ignore_" + multi_edit + "']").prop('checked', false); var $this_input = $("input[name='fields[multi_edit][" + multi_edit + "][" + urlField + "]']"); // Does this field come from datepicker? @@ -259,7 +259,7 @@ $(document).ready(function() { $("input[name='gis_data[save]']").live('click', function(event) { var input_name = $('form#gis_data_editor_form').find("input[name='input_name']").val(); var $null_checkbox = $("input[name='" + input_name + "']").parents('tr').find('.checkbox_null'); - $null_checkbox.attr('checked', false); + $null_checkbox.prop('checked', false); }); // these were hidden via the "hide" class @@ -441,7 +441,7 @@ $(document).ready(function() { if ($this_element.is('.textfield')) { // do not remove the 'value' attribute for ENUM columns if ($this_element.closest('tr').find('span.column_type').html() != 'enum') { - $this_element.attr('value', $this_element.closest('tr').find('span.default_value').html()); + $this_element.val($this_element.closest('tr').find('span.default_value').html()); } $this_element .unbind('change') @@ -515,7 +515,8 @@ $(document).ready(function() { $(last_checkbox) .clone() - .attr({'id':new_name, 'name': new_name, 'checked': true}) + .attr({'id':new_name, 'name': new_name}) + .prop('checked', true) .add('label[for^=insert_ignore]:last') .clone() .attr('for', new_name) diff --git a/js/tbl_chart.js b/js/tbl_chart.js index 97bb92ace7..7bacc1e4dc 100644 --- a/js/tbl_chart.js +++ b/js/tbl_chart.js @@ -6,7 +6,7 @@ $(document).ready(function() { var currentChart = null; var chart_data = jQuery.parseJSON($('#querychart').html()); chart_series = 'columns'; - chart_xaxis_idx = $('select[name="chartXAxis"]').attr('value'); + chart_xaxis_idx = $('select[name="chartXAxis"]').val(); $('#resizer').resizable({ minHeight:240, @@ -31,13 +31,13 @@ $(document).ready(function() { height: $('#resizer').height() - 20 }, xAxis: { - title: { text: $('input[name="xaxis_label"]').attr('value') } + title: { text: $('input[name="xaxis_label"]').val() } }, yAxis: { - title: { text: $('input[name="yaxis_label"]').attr('value') } + title: { text: $('input[name="yaxis_label"]').val() } }, title: { - text: $('input[name="chartTitle"]').attr('value'), + text: $('input[name="chartTitle"]').val(), margin:20 }, plotOptions: { @@ -48,11 +48,11 @@ $(document).ready(function() { $('#querychart').html(''); $('input[name="chartType"]').click(function() { - currentSettings.chart.type = $(this).attr('value'); + currentSettings.chart.type = $(this).val(); drawChart(); - if ($(this).attr('value') == 'bar' || $(this).attr('value') == 'column') { + if ($(this).val() == 'bar' || $(this).val() == 'column') { $('span.barStacked').show(); } else { $('span.barStacked').hide(); @@ -69,7 +69,7 @@ $(document).ready(function() { }); $('input[name="chartTitle"]').keyup(function() { - var title = $(this).attr('value'); + var title = $(this).val(); if (title.length == 0) { title = ' '; } @@ -88,11 +88,11 @@ $(document).ready(function() { /* Sucks, we cannot just set axis labels, we have to redraw the chart completely */ $('input[name="xaxis_label"]').keyup(function() { - currentSettings.xAxis.title.text = $(this).attr('value'); + currentSettings.xAxis.title.text = $(this).val(); drawChart(true); }); $('input[name="yaxis_label"]').keyup(function() { - currentSettings.yAxis.title.text = $(this).attr('value'); + currentSettings.yAxis.title.text = $(this).val(); drawChart(true); }); @@ -119,7 +119,7 @@ $(document).ready(function() { function in_array(element, array) { - for (var i = 0; i < array.length; i++) { + for (var i = 0, l = array.length; i < l; i++) { if (array[i] == element) { return true; } @@ -133,7 +133,7 @@ function PMA_queryChart(data, passedSettings) return; } - var columnNames = Array(); + var columnNames = []; var series = new Array(); var xaxis = { type: 'linear' }; @@ -152,7 +152,7 @@ function PMA_queryChart(data, passedSettings) if (chart_series == 'columns') { var j = 0; - for (var i = 0; i 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..7cb05f0792 100644 --- a/js/tbl_structure.js +++ b/js/tbl_structure.js @@ -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..16dee21b11 100644 --- a/js/tbl_zoom_plot.js +++ b/js/tbl_zoom_plot.js @@ -318,7 +318,7 @@ $(document).ready(function() { var yChange = false; 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(); @@ -602,11 +602,11 @@ $(document).ready(function() { $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]);
' + PMA_messages['strStatus'] + '' + PMA_messages['strTime'] + '