diff --git a/js/config.js b/js/config.js index b965045ca8..038cc8b0b5 100644 --- a/js/config.js +++ b/js/config.js @@ -511,14 +511,14 @@ $(function() { */ function setTab(tab_id) { - $('.tabs li').removeClass('active').find('a[href=#' + tab_id + ']').parent().addClass('active'); - $('.tabs_contents fieldset').hide().filter('#' + tab_id).show(); + $('ul.tabs li').removeClass('active').find('a[href=#' + tab_id + ']').parent().addClass('active'); + $('div.tabs_contents fieldset').hide().filter('#' + tab_id).show(); location.hash = 'tab_' + tab_id; - $('.config-form input[name=tab_hash]').val(location.hash); + $('form.config-form input[name=tab_hash]').val(location.hash); } $(function() { - var tabs = $('.tabs'); + var tabs = $('ul.tabs'); if (!tabs.length) { return; } @@ -531,7 +531,7 @@ $(function() { .filter(':first') .parent() .addClass('active'); - $('.tabs_contents fieldset').hide().filter(':first').show(); + $('div.tabs_contents fieldset').hide().filter(':first').show(); // tab links handling, check each 200ms // (works with history in FF, further browser support here would be an overkill) @@ -588,7 +588,7 @@ function restoreField(field_id) } $(function() { - $('.tabs_contents') + $('div.tabs_contents') .delegate('.restore-default, .set-value', 'mouseenter', function(){$(this).css('opacity', 1)}) .delegate('.restore-default, .set-value', 'mouseleave', function(){$(this).css('opacity', 0.25)}) .delegate('.restore-default, .set-value', 'click', function(e) { @@ -641,8 +641,8 @@ $(function() { // detect localStorage state var ls_supported = window.localStorage || false; var ls_exists = ls_supported ? (window.localStorage['config'] || false) : false; - $('.localStorage-'+(ls_supported ? 'un' : '')+'supported').hide(); - $('.localStorage-'+(ls_exists ? 'empty' : 'exists')).hide(); + $('div.localStorage-'+(ls_supported ? 'un' : '')+'supported').hide(); + $('div.localStorage-'+(ls_exists ? 'empty' : 'exists')).hide(); if (ls_exists) { updatePrefsDate(); } @@ -668,10 +668,13 @@ $(function() { } }); - $('.click-hide-message').live('click', function(){ - var div = $(this); - div.hide().parent('.group').css('height', ''); - div.next('form').show(); + $('div.click-hide-message').live('click', function(){ + $(this) + .hide() + .parent('.group') + .css('height', '') + .next('form') + .show(); }); }); @@ -698,8 +701,8 @@ function savePrefsToLocalStorage(form) window.localStorage['config_mtime'] = response.mtime; window.localStorage['config_mtime_local'] = (new Date()).toUTCString(); updatePrefsDate(); - $('.localStorage-empty').hide(); - $('.localStorage-exists').show(); + $('div.localStorage-empty').hide(); + $('div.localStorage-exists').show(); var group = form.parent('.group'); group.css('height', group.height() + 'px'); form.hide('fast'); @@ -718,7 +721,7 @@ function updatePrefsDate() { var d = new Date(window.localStorage['config_mtime_local']); var msg = PMA_messages['strSavedOn'].replace('@DATE@', formatDate(d)); - $('#opts_import_local_storage .localStorage-exists').html(msg); + $('#opts_import_local_storage div.localStorage-exists').html(msg); } /** diff --git a/js/db_operations.js b/js/db_operations.js index 2adbc02cad..83f5da3908 100644 --- a/js/db_operations.js +++ b/js/db_operations.js @@ -96,8 +96,7 @@ $(document).ready(function() { $.get($form.attr('action'), $form.serialize(), function(data) { // use messages that stay on screen - $('.success').fadeOut(); - $('.error').fadeOut(); + $('div.success, div.error').fadeOut(); if(data.success == true) { $('#floating_menubar').after(data.message); if( $("#checkbox_switch").is(":checked")) { diff --git a/js/db_structure.js b/js/db_structure.js index 9ccc8adc7a..477e1f54e8 100644 --- a/js/db_structure.js +++ b/js/db_structure.js @@ -182,7 +182,7 @@ $(document).ready(function() { $dialog.find('.datefield, .datetimefield').each(function () { PMA_addDatepicker($(this)); }); - $(".insertRowTable").addClass("ajax"); + $("table.insertRowTable").addClass("ajax"); $("#buttonYes").addClass("ajax"); $div = $("#insert_table_dialog"); PMA_convertFootnotesToTooltips($div); @@ -257,7 +257,7 @@ $(document).ready(function() { * Event handler for 'Foreign Key Checks' disabling option * in the drop table confirmation form */ - $(".fkc_switch").click(function(event){ + $("span.fkc_switch").click(function(event){ if ($("#fkc_checkbox").prop('checked')) { $("#fkc_checkbox").prop('checked', false); $("#fkc_status").html(PMA_messages['strForeignKeyCheckDisabled']); @@ -282,7 +282,7 @@ $(document).ready(function() { * @uses PMA_ajaxShowMessage() * @see $cfg['AjaxEnable'] */ - $(".truncate_table_anchor").live('click', function(event) { + $("a.truncate_table_anchor").live('click', function(event) { event.preventDefault(); /** @@ -336,7 +336,7 @@ $(document).ready(function() { * @uses PMA_ajaxShowMessage() * @see $cfg['AjaxEnable'] */ - $(".drop_table_anchor").live('click', function(event) { + $("a.drop_table_anchor").live('click', function(event) { event.preventDefault(); var $this_anchor = $(this); @@ -383,7 +383,7 @@ $(document).ready(function() { * @uses PMA_ajaxShowMessage() * @see $cfg['AjaxEnable'] */ - $('.drop_tracking_anchor').live('click', function(event) { + $('a.drop_tracking_anchor').live('click', function(event) { event.preventDefault(); var $anchor = $(this); diff --git a/js/export.js b/js/export.js index 8801e31fd7..e3504522f6 100644 --- a/js/export.js +++ b/js/export.js @@ -10,9 +10,7 @@ */ $(document).ready(function() { $("#plugins").change(function() { - $(".format_specific_options").each(function() { - $(this).hide(); - }); + $("#format_specific_opts div.format_specific_options").hide(); var selected_plugin_name = $("#plugins option:selected").val(); $("#" + selected_plugin_name + "_options").show(); }); @@ -193,8 +191,15 @@ $(document).ready(function() { $("#quick_or_custom").show(); } $("#scroll_to_options_msg").hide(); - $(".format_specific_options").hide().css({"border": 0, "margin": 0, "padding": 0}); - $(".format_specific_options h3").remove(); + $("#format_specific_opts div.format_specific_options") + .hide() + .css({ + "border": 0, + "margin": 0, + "padding": 0 + }) + .find("h3") + .remove(); toggle_quick_or_custom(); toggle_structure_data_opts($("select#plugins").val()); toggle_sql_include_comments(); diff --git a/js/functions.js b/js/functions.js index 48e20d7c48..9b902bc529 100644 --- a/js/functions.js +++ b/js/functions.js @@ -607,9 +607,9 @@ $(document).ready(function() { * (only when timepicker.js is loaded) */ if ($.timepicker != undefined) { - $('.datefield, .datetimefield').each(function() { + $('input.datefield, input.datetimefield').each(function() { PMA_addDatepicker($(this)); - }); + }); } }); @@ -1050,7 +1050,7 @@ function pdfPaperSize(format, axis) * Jquery Coding for inline editing SQL_QUERY */ $(document).ready(function() { - $(".inline_edit_sql").live('click', function() { + $("a.inline_edit_sql").live('click', function() { if ($('#sql_query_edit').length) { // An inline query editor is already open, // we don't want another copy of it @@ -1079,7 +1079,7 @@ $(document).ready(function() { codemirror_editor.getScrollerElement().style.height = height; codemirror_editor.refresh(); - $(".btnSave").click(function() { + $("input.btnSave").click(function() { if (codemirror_editor !== undefined) { var sql_query = codemirror_editor.getValue(); } else { @@ -1091,13 +1091,13 @@ $(document).ready(function() { .append($('', {type: 'hidden', name: 'sql_query', value: sql_query})); $fake_form.appendTo($('body')).submit(); }); - $(".btnDiscard").click(function() { + $("input.btnDiscard").click(function() { $(this).closest(".sql").html("" + old_text + ""); }); return false; }); - $('.sqlbutton').click(function(evt) { + $('input.sqlbutton').click(function(evt) { insertQuery(evt.target.id); return false; }); @@ -1227,7 +1227,7 @@ function PMA_ajaxShowMessage(message, timeout) // Update message count to create distinct message elements every time ajax_message_count++; // Remove all old messages, if any - $(".ajax_notification[id^=ajax_message_num]").remove(); + $("span.ajax_notification[id^=ajax_message_num]").remove(); /** * @var $retval a jQuery object containing the reference * to the created AJAX message @@ -1312,20 +1312,20 @@ $(document).ready(function() { * Allows the user to dismiss a notification * created with PMA_ajaxShowMessage() */ - $('.ajax_notification.dismissable').live('click', function () { + $('span.ajax_notification.dismissable').live('click', function () { PMA_ajaxRemoveMessage($(this)); }); /** * The below two functions hide the "Dismiss notification" tooltip when a user * is hovering a link or button that is inside an ajax message */ - $('.ajax_notification a, .ajax_notification button, .ajax_notification input') + $('span.ajax_notification a, span.ajax_notification button, span.ajax_notification input') .live('mouseover', function () { - $(this).parents('.ajax_notification').qtip('hide'); + $(this).parents('span.ajax_notification').qtip('hide'); }); - $('.ajax_notification a, .ajax_notification button, .ajax_notification input') + $('span.ajax_notification a, span.ajax_notification button, span.ajax_notification input') .live('mouseout', function () { - $(this).parents('.ajax_notification').qtip('show'); + $(this).parents('span.ajax_notification').qtip('show'); }); }); @@ -1417,7 +1417,7 @@ function PMA_createTableDialog( $div, url , target) $(this) .scrollTop(0) // for Chrome - .closest('.ui-dialog').css({ + .closest('div.ui-dialog').css({ left: 0, top: 0 }); @@ -1425,7 +1425,7 @@ function PMA_createTableDialog( $div, url , target) PMA_verifyColumnsProperties(); // move the Cancel button next to the Save button - var $button_pane = $('.ui-dialog-buttonpane'); + var $button_pane = $('div.ui-dialog-buttonpane'); var $cancel_button = $button_pane.find('.ui-button'); var $save_button = $('#create_table_form').find("input[name='do_save_data']"); $cancel_button.insertAfter($save_button); @@ -2100,8 +2100,8 @@ $(document).ready(function() { $.post($form.attr('action'), $form.serialize()+"&do_save_data=Save", function(data) { if ($("#sqlqueryresults").length != 0) { $("#sqlqueryresults").remove(); - } else if ($(".error").length != 0) { - $(".error").remove(); + } else if ($("div.error").length != 0) { + $("div.error").remove(); } if (data.success == true) { PMA_ajaxShowMessage(data.message); @@ -2122,7 +2122,7 @@ $(document).ready(function() { if ($("#sqlqueryresults").length != 0) { $temp_div.find("#fieldsForm").insertAfter("#sqlqueryresults"); } else { - $temp_div.find("#fieldsForm").insertAfter(".error"); + $temp_div.find("#fieldsForm").insertAfter("div.error"); } $temp_div.find("#addColumns").insertBefore("iframe.IE_hack"); /*Call the function to display the more options in table*/ @@ -2438,10 +2438,10 @@ $(document).ready(function() { $("select.column_type").live('change', function() { PMA_showNoticeForEnum($(this)); }); - $(".default_type").live('change', function() { + $("select.default_type").live('change', function() { PMA_hideShowDefaultValue($(this)); }); - $('.allow_null').live('change', function() { + $('input.allow_null').live('change', function() { PMA_validateDefaultValue($(this)); }); }); @@ -2451,7 +2451,7 @@ function PMA_verifyColumnsProperties() $("select.column_type").each(function() { PMA_showNoticeForEnum($(this)); }); - $(".default_type").each(function() { + $("select.default_type").each(function() { PMA_hideShowDefaultValue($(this)); }); } @@ -2637,7 +2637,7 @@ $(document).ready(function() { } }); // Focus the slider, otherwise it looks nearly transparent - $('.ui-slider-handle').addClass('ui-state-focus'); + $('a.ui-slider-handle').addClass('ui-state-focus'); return false; }); @@ -2689,7 +2689,7 @@ function displayMoreTableOpts() $table.find("td.more_opts").show(); // Position the dropdown - $(".structure_actions_dropdown").each(function() { + $("div.structure_actions_dropdown").each(function() { // Optimize DOM querying var $this_dropdown = $(this); // The top offset must be set for IE even if it didn't change @@ -2723,19 +2723,19 @@ function displayMoreTableOpts() left: $after_field.offset().left }); } - $(".structure_actions_dropdown").hide(); // Hide all the other ones that may be open - $(this).children(".structure_actions_dropdown").show(); + $("div.structure_actions_dropdown").hide(); // Hide all the other ones that may be open + $(this).children("div.structure_actions_dropdown").show(); // Need to do this again for IE otherwise the offset is wrong if ($.browser.msie) { - var left_offset_IE = $(this).offset().left + $(this).innerWidth() - $(this).children(".structure_actions_dropdown").innerWidth(); + var left_offset_IE = $(this).offset().left + $(this).innerWidth() - $(this).children("div.structure_actions_dropdown").innerWidth(); var top_offset_IE = $(this).offset().top + $(this).innerHeight(); - $(this).children(".structure_actions_dropdown").offset({ + $(this).children("div.structure_actions_dropdown").offset({ top: top_offset_IE, left: left_offset_IE }); } }) .mouseleave(function() { - $(this).children(".structure_actions_dropdown").hide(); + $(this).children("div.structure_actions_dropdown").hide(); if ($.browser.msie && $.browser.version == "6.0") { $("iframe.IE_hack").hide(); } @@ -2977,7 +2977,7 @@ function PMA_set_status_label($element) */ function PMA_init_slider() { - $('.pma_auto_slider').each(function() { + $('div.pma_auto_slider').each(function() { var $this = $(this); if ($this.hasClass('slider_init_done')) { @@ -3016,7 +3016,7 @@ function PMA_init_slider() var toggleButton = function ($obj) { // In rtl mode the toggle switch is flipped horizontally // so we need to take that into account - if ($('.text_direction', $obj).text() == 'ltr') { + if ($('span.text_direction', $obj).text() == 'ltr') { var right = 'right'; } else { var right = 'left'; @@ -3032,12 +3032,12 @@ var toggleButton = function ($obj) { * var on Width of the "ON" part of the toggle switch * var off Width of the "OFF" part of the toggle switch */ - var on = $('.toggleOn', $obj).width(); - var off = $('.toggleOff', $obj).width(); + var on = $('td.toggleOn', $obj).width(); + var off = $('td.toggleOff', $obj).width(); // Make the "ON" and "OFF" parts of the switch the same size // + 2 pixels to avoid overflowed - $('.toggleOn > div', $obj).width(Math.max(on, off) + 2); - $('.toggleOff > div', $obj).width(Math.max(on, off) + 2); + $('td.toggleOn > div', $obj).width(Math.max(on, off) + 2); + $('td.toggleOff > div', $obj).width(Math.max(on, off) + 2); /** * var w Width of the central part of the switch */ @@ -3060,7 +3060,7 @@ var toggleButton = function ($obj) { * var offw Outer width of the "ON" part of the toggle switch * var btnw Outer width of the central part of the switch */ - var offw = $('.toggleOff', $obj).outerWidth(); + var offw = $('td.toggleOff', $obj).outerWidth(); var btnw = $('table td:nth-child(2)', $obj).outerWidth(); // Resize the main div so that exactly one side of // the switch plus the central part fit into it. @@ -3069,18 +3069,18 @@ var toggleButton = function ($obj) { * var move How many pixels to move the * switch by when toggling */ - var move = $('.toggleOff', $obj).outerWidth(); + var move = $('td.toggleOff', $obj).outerWidth(); // If the switch is initialized to the // OFF state we need to move it now. - if ($('.container', $obj).hasClass('off')) { + if ($('div.container', $obj).hasClass('off')) { if (right == 'right') { - $('.container', $obj).animate({'left': '-=' + move + 'px'}, 0); + $('div.container', $obj).animate({'left': '-=' + move + 'px'}, 0); } else { - $('.container', $obj).animate({'left': '+=' + move + 'px'}, 0); + $('div.container', $obj).animate({'left': '+=' + move + 'px'}, 0); } } // Attach an 'onclick' event to the switch - $('.container', $obj).click(function () { + $('div.container', $obj).click(function () { if ($(this).hasClass('isActive')) { return false; } else { @@ -3088,7 +3088,7 @@ var toggleButton = function ($obj) { } var $msg = PMA_ajaxShowMessage(); var $container = $(this); - var callback = $('.callback', this).text(); + var callback = $('span.callback', this).text(); // Perform the actual toggle if ($(this).hasClass('on')) { if (right == 'right') { @@ -3096,7 +3096,7 @@ var toggleButton = function ($obj) { } else { var operator = '+='; } - var url = $(this).find('.toggleOff > span').text(); + var url = $(this).find('td.toggleOff > span').text(); var removeClass = 'on'; var addClass = 'off'; } else { @@ -3105,7 +3105,7 @@ var toggleButton = function ($obj) { } else { var operator = '-='; } - var url = $(this).find('.toggleOn > span').text(); + var url = $(this).find('td.toggleOn > span').text(); var removeClass = 'off'; var addClass = 'on'; } @@ -3131,7 +3131,7 @@ var toggleButton = function ($obj) { * Initialise all toggle buttons */ $(window).load(function () { - $('.toggleAjax').each(function () { + $('div.toggleAjax').each(function () { $(this).show(); toggleButton($(this)); }); @@ -3217,7 +3217,7 @@ $(document).ready(function() { /** * Load version information asynchronously. */ - if ($('.jsversioncheck').length > 0) { + if ($('li.jsversioncheck').length > 0) { $.getScript('http://www.phpmyadmin.net/home_page/version.js', PMA_current_version); } @@ -3554,7 +3554,7 @@ $(document).ready(function() { /** * Theme changer. */ - $('.take_theme').click(function(e) { + $('a.take_theme').click(function(e) { var what = this.name; if (window.opener && window.opener.document.forms['setTheme'].elements['set_theme']) { window.opener.document.forms['setTheme'].elements['set_theme'].value = what; diff --git a/js/gis_data_editor.js b/js/gis_data_editor.js index b88e723465..2901273f4a 100644 --- a/js/gis_data_editor.js +++ b/js/gis_data_editor.js @@ -12,8 +12,9 @@ var gisEditorLoaded = false; */ function closeGISEditor(){ $("#popup_background").fadeOut("fast"); - $("#gis_editor").fadeOut("fast"); - $("#gis_editor").html(''); + $("#gis_editor").fadeOut("fast", function () { + $(this).html(''); + }); } /** @@ -24,7 +25,7 @@ function prepareJSVersion() { $('.go').hide(); // Change the text on the submit button - $("input[name='gis_data[save]']") + $("#gis_editor input[name='gis_data[save]']") .val(PMA_messages['strCopy']) .insertAfter($('#gis_data_textarea')) .before('

'); @@ -38,14 +39,14 @@ function prepareJSVersion() { $('div#gis_data_output p').remove(); // Remove 'add' buttons and add links - $('.add').each(function(e) { + $('#gis_editor input.add').each(function(e) { var $button = $(this); $button.addClass('addJs').removeClass('add'); var classes = $button.attr('class'); - $button - .after('+ ' + $button.val() + '') - .remove(); + $button.replaceWith( + '+ ' + $button.val() + '' + ); }); } @@ -204,12 +205,12 @@ function insertDataAndClose() { $(document).ready(function() { // Remove the class that is added due to the URL being too long. - $('.open_gis_editor a').removeClass('formLinkSubmit'); + $('span.open_gis_editor a').removeClass('formLinkSubmit'); /** * Prepares and insert the GIS data to the input field on clicking 'copy'. */ - $("input[name='gis_data[save]']").live('click', function(event) { + $("#gis_editor input[name='gis_data[save]']").live('click', function(event) { event.preventDefault(); insertDataAndClose(); }); @@ -243,7 +244,7 @@ $(document).ready(function() { /** * Update the form on change of the GIS type. */ - $(".gis_type").live('change', function(event) { + $("#gis_editor select.gis_type").live('change', function(event) { var $gis_editor = $("#gis_editor"); var $form = $('form#gis_data_editor_form'); @@ -261,14 +262,14 @@ $(document).ready(function() { /** * Handles closing of the GIS data editor. */ - $('.close_gis_editor, .cancel_gis_editor').live('click', function() { + $('#gis_editor a.close_gis_editor, #gis_editor a.cancel_gis_editor').live('click', function() { closeGISEditor(); }); /** * Handles adding data points */ - $('.addJs.addPoint').live('click', function() { + $('#gis_editor a.addJs.addPoint').live('click', function() { var $a = $(this); var name = $a.attr('name'); // Eg. name = gis_data[0][MULTIPOINT][add_point] => prefix = gis_data[0][MULTIPOINT] @@ -285,7 +286,7 @@ $(document).ready(function() { /** * Handles adding linestrings and inner rings */ - $('.addLine.addJs').live('click', function() { + $('#gis_editor a.addLine.addJs').live('click', function() { var $a = $(this); var name = $a.attr('name'); @@ -320,7 +321,7 @@ $(document).ready(function() { /** * Handles adding polygons */ - $('.addJs.addPolygon').live('click', function() { + $('#gis_editor a.addJs.addPolygon').live('click', function() { var $a = $(this); var name = $a.attr('name'); // Eg. name = gis_data[0][MULTIPOLYGON][add_polygon] => prefix = gis_data[0][MULTIPOLYGON] @@ -349,7 +350,7 @@ $(document).ready(function() { /** * Handles adding geoms */ - $('.addJs.addGeom').live('click', function() { + $('#gis_editor a.addJs.addGeom').live('click', function() { var $a = $(this); var prefix = 'gis_data[GEOMETRYCOLLECTION]'; // Find the number of geoms diff --git a/js/import.js b/js/import.js index 8b25e85aa2..85a749d724 100644 --- a/js/import.js +++ b/js/import.js @@ -11,7 +11,7 @@ */ function changePluginOpts() { - $(".format_specific_options").each(function() { + $("#format_specific_opts div.format_specific_options").each(function() { $(this).hide(); }); var selected_plugin_name = $("#plugins option:selected").val(); @@ -78,7 +78,13 @@ $(document).ready(function() { * Javascript-disabled browsers */ $("#scroll_to_options_msg").hide(); - $(".format_specific_options").css({ "border": 0, "margin": 0, "padding": 0 }); - $(".format_specific_options h3").remove(); + $("#format_specific_opts div.format_specific_options") + .css({ + "border": 0, + "margin": 0, + "padding": 0 + }) + .find("h3") + .remove(); //$("form[name=import] *").unwrap(); }); diff --git a/js/makegrid.js b/js/makegrid.js index 459205e0de..38dc220487 100644 --- a/js/makegrid.js +++ b/js/makegrid.js @@ -250,7 +250,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi $(g.cRsz).find('div').hide(); 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'); + $('table.pma_table').find('thead th:first').removeClass('before-condition'); for (var n = 0, l = $firstRowCols.length; n < l; n++) { var $col = $($firstRowCols[n]); $($resizeHandles[n]).css('left', $col.position().left + $col.outerWidth(true)) @@ -263,7 +263,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi } } if ($($resizeHandles[0]).hasClass('condition')) { - $('.pma_table').find('thead th:first').addClass('before-condition'); + $('table.pma_table').find('thead th:first').addClass('before-condition'); } $(g.cRsz).css('height', $(g.t).height()); }, @@ -410,9 +410,9 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi var isOneColumn = g.visibleHeadersCount == 1; // enable or disable restore button if (isInitial || isOneColumn) { - $('.restore_column').hide(); + $('div.restore_column').hide(); } else { - $('.restore_column').show(); + $('div.restore_column').show(); } }, @@ -1047,7 +1047,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi /** * @var is_unique Boolean, whether the rows in this table is unique or not */ - var is_unique = $('.edit_row_anchor').is('.nonunique') ? 0 : 1; + var is_unique = $('td.edit_row_anchor').is('.nonunique') ? 0 : 1; /** * multi edit variables */ @@ -1061,7 +1061,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi } // loop each edited row - $('.to_be_saved').parents('tr').each(function() { + $('td.to_be_saved').parents('tr').each(function() { var $tr = $(this); var where_clause = $tr.find('.where_clause').val(); full_where_clause.push(PMA_urldecode(where_clause)); @@ -1183,7 +1183,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi $(g.cEdit).find('*').prop('disabled', true); $(g.cEdit).find('.edit_box').addClass('edit_box_posting'); } else { - $('.save_edited').addClass('saving_edited_data') + $('div.save_edited').addClass('saving_edited_data') .find('input').prop('disabled', true); // disable the save button } @@ -1198,13 +1198,13 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi $(g.cEdit).find('*').removeProp('disabled'); $(g.cEdit).find('.edit_box').removeClass('edit_box_posting'); } else { - $('.save_edited').removeClass('saving_edited_data') + $('div.save_edited').removeClass('saving_edited_data') .find('input').removeProp('disabled'); // enable the save button back } if(data.success == true) { PMA_ajaxShowMessage(data.message); // update where_clause related data in each edited row - $('.to_be_saved').parents('tr').each(function() { + $('td.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.val(); @@ -1245,7 +1245,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi g.hideEditCell(true, data); // remove the "Save edited cells" button - $('.save_edited').hide(); + $('div.save_edited').hide(); // update saved fields $(g.t).find('.to_be_saved') .removeClass('to_be_saved') @@ -1329,7 +1329,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi $(g.currentEditCell).addClass('to_be_saved') .data('value', this_field_params[field_name]); if (g.saveCellsAtOnce) { - $('.save_edited').show(); + $('div.save_edited').show(); } g.isCellEdited = true; } @@ -1454,7 +1454,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi .find("input").focus().select(); }); // restore column order when the restore button is clicked - $('.restore_column').click(function() { + $('div.restore_column').click(function() { g.restoreColOrder(); }); @@ -1646,7 +1646,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi g.hideEditCell(true); } }); - $('.save_edited').click(function() { + $('div.save_edited').click(function() { g.hideEditCell(); g.postEditedCell(); }); @@ -1701,7 +1701,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi g.copyHint = PMA_messages['strColNameCopyHint']; // assign common hidden inputs - var $common_hidden_inputs = $('.common_hidden_inputs'); + var $common_hidden_inputs = $('div.common_hidden_inputs'); g.token = $common_hidden_inputs.find('input[name=token]').val(); g.server = $common_hidden_inputs.find('input[name=server]').val(); g.db = $common_hidden_inputs.find('input[name=db]').val(); @@ -1726,7 +1726,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi g.initColResize(); } if (enableReorder && - $('.navigation').length > 0) // disable reordering for result from EXPLAIN or SHOW syntax, which do not have a table navigation panel + $('table.navigation').length > 0) // disable reordering for result from EXPLAIN or SHOW syntax, which do not have a table navigation panel { g.initColReorder(); } diff --git a/js/rte/common.js b/js/rte/common.js index 859d6e1efc..8804f23765 100644 --- a/js/rte/common.js +++ b/js/rte/common.js @@ -161,7 +161,7 @@ $(document).ready(function () { $('table.data').append(data.new_row); } // Fade-in the new row - $('.ajaxInsert').show('slow').removeClass('ajaxInsert'); + $('tr.ajaxInsert').show('slow').removeClass('ajaxInsert'); } else if ($('table.data').find('tr').has('td').length === 0) { // If we are not supposed to insert the new row, we will now // check if the table is empty and needs to be hidden. This diff --git a/js/rte/routines.js b/js/rte/routines.js index 27c2aea255..f260dcabd0 100644 --- a/js/rte/routines.js +++ b/js/rte/routines.js @@ -223,7 +223,7 @@ $(document).ready(function () { * @var $routine_params_table jQuery object containing the reference * to the routine parameters table. */ - var $routine_params_table = $('.routine_params_table').last(); + var $routine_params_table = $('table.routine_params_table').last(); /** * @var $new_param_row A string containing the HTML code for the * new row for the routine paramaters table. diff --git a/js/server_privileges.js b/js/server_privileges.js index 26c9f82a6f..c1d55d73ac 100644 --- a/js/server_privileges.js +++ b/js/server_privileges.js @@ -353,7 +353,7 @@ $(document).ready(function() { * @name edit_user_click * @see $cfg['AjaxEnable'] */ - $(".edit_user_anchor.ajax").live('click', function(event) { + $("a.edit_user_anchor.ajax").live('click', function(event) { /** @lends jQuery */ event.preventDefault(); @@ -526,7 +526,7 @@ $(document).ready(function() { ); } - $(".export_user_anchor.ajax").live('click', function(event) { + $("a.export_user_anchor.ajax").live('click', function(event) { event.preventDefault(); var $msgbox = PMA_ajaxShowMessage(); /** diff --git a/js/server_status.js b/js/server_status.js index aeda9fdbb2..71f0e9b2f6 100644 --- a/js/server_status.js +++ b/js/server_status.js @@ -16,7 +16,7 @@ // Add a tablesorter parser to properly handle thousands seperated numbers and SI prefixes $(function() { // Show all javascript related parts of the page - $('.jsfeature').show(); + $('#serverstatus .jsfeature').show(); jQuery.tablesorter.addParser({ id: "fancyNumber", @@ -79,7 +79,7 @@ $(function() { $('a.popupLink').click( function() { var $link = $(this); - $('.' + $link.attr('href').substr(1)) + $('div.' + $link.attr('href').substr(1)) .show() .offset({ top: $link.offset().top + $link.height() + 5, left: $link.offset().left }) .addClass('openedPopup'); @@ -88,7 +88,7 @@ $(function() { }); $(document).click( function(event) { - $('.openedPopup').each(function() { + $('div.openedPopup').each(function() { var $cnt = $(this); var pos = $cnt.offset(); @@ -188,7 +188,7 @@ $(function() { }); // Handles refresh rate changing - $('.buttonlinks select').change(function() { + $('div.buttonlinks select').change(function() { var chart = tabChart[$(this).parents('div.ui-tabs-panel').attr('id')]; // Clear current timeout and set timeout with the new refresh rate @@ -212,7 +212,7 @@ $(function() { }); // Ajax refresh of variables (always the first element in each tab) - $('.buttonlinks a.tabRefresh').click(function() { + $('div.buttonlinks a.tabRefresh').click(function() { // ui-tabs-panel class is added by the jquery tabs feature var tab = $(this).parents('div.ui-tabs-panel'); var that = this; @@ -234,7 +234,7 @@ $(function() { /** Realtime charting of variables **/ // Live traffic charting - $('.buttonlinks a.livetrafficLink').click(function() { + $('div.buttonlinks a.livetrafficLink').click(function() { // ui-tabs-panel class is added by the jquery tabs feature var $tab = $(this).parents('div.ui-tabs-panel'); var tabstat = tabStatus[$tab.attr('id')]; @@ -281,7 +281,7 @@ $(function() { }); // Live connection/process charting - $('.buttonlinks a.liveconnectionsLink').click(function() { + $('div.buttonlinks a.liveconnectionsLink').click(function() { var $tab = $(this).parents('div.ui-tabs-panel'); var tabstat = tabStatus[$tab.attr('id')]; @@ -327,7 +327,7 @@ $(function() { }); // Live query statistics - $('.buttonlinks a.livequeriesLink').click(function() { + $('div.buttonlinks a.livequeriesLink').click(function() { var $tab = $(this).parents('div.ui-tabs-panel'); var settings = null; diff --git a/js/server_synchronize.js b/js/server_synchronize.js index 0c2adc4890..fc0cdfe477 100644 --- a/js/server_synchronize.js +++ b/js/server_synchronize.js @@ -319,18 +319,18 @@ function hideOrDisplayServerFields($server_selector, selected_option) } $(document).ready(function() { - $('.server_selector').change(function(evt) { + $('select.server_selector').change(function(evt) { var selected_option = $(evt.target).val(); hideOrDisplayServerFields($(evt.target), selected_option); }); // initial display of the selectors - $('.server_selector').each(function() { + $('select.server_selector').each(function() { var selected_option = $(this).val(); hideOrDisplayServerFields($(this), selected_option); }); - $('.struct_img').hover( + $('img.struct_img').hover( // pmaThemeImage comes from js/messages.php function() { // mouse enters the element @@ -354,7 +354,7 @@ $(document).ready(function() { } ); - $('.data_img').hover( + $('img.data_img').hover( function() { // mouse enters the element var $img = $(this); diff --git a/js/sql.js b/js/sql.js index 252b2fa7f1..47210b12c4 100644 --- a/js/sql.js +++ b/js/sql.js @@ -179,7 +179,7 @@ $(document).ready(function() { } // remove any div containing a previous error message - $('.error').remove(); + $('div.error').remove(); var $msgbox = PMA_ajaxShowMessage(); var $sqlqueryresults = $('#sqlqueryresults'); @@ -191,8 +191,7 @@ $(document).ready(function() { // success happens if the query returns rows or not // // fade out previous messages, if any - $('.success').fadeOut(); - $('.sqlquery_message').fadeOut(); + $('div.success, div.sqlquery_message').fadeOut(); // show a message that stays on screen if (typeof data.action_bookmark != 'undefined') { // view only @@ -211,7 +210,7 @@ $(document).ready(function() { .html(data.sql_query) .insertBefore('#sqlqueryform'); // unnecessary div that came from data.sql_query - $('.notice').remove(); + $('div.notice').remove(); } else { $('#sqlqueryform').before(data.message); } @@ -235,8 +234,7 @@ $(document).ready(function() { } else { // real results are returned // fade out previous messages, if any - $('.success').fadeOut(); - $('.sqlquery_message').fadeOut(); + $('div.success, div.sqlquery_message').fadeOut(); var $received_data = $(data); var $zero_row_results = $received_data.find('textarea[name="sql_query"]'); // if zero rows are returned from the query execution @@ -417,7 +415,7 @@ $(document).ready(function() { //Remove the top menu container from the dialog .find("#topmenucontainer").hide() ; // end dialog options - $(".insertRowTable").addClass("ajax"); + $("table.insertRowTable").addClass("ajax"); $("#buttonYes").addClass("ajax"); } PMA_ajaxRemoveMessage($msgbox); @@ -546,25 +544,24 @@ function PMA_changeClassForColumn($this_th, newclass, isAddClass) $(document).ready(function() { - $('.browse_foreign').live('click', function(e) { + $('a.browse_foreign').live('click', function(e) { e.preventDefault(); window.open(this.href, 'foreigners', 'width=640,height=240,scrollbars=yes,resizable=yes'); $anchor = $(this); $anchor.addClass('browse_foreign_clicked'); - return false; }); /** * vertical column highlighting in horizontal mode when hovering over the column header */ - $('.column_heading.pointer').live('hover', function(e) { + $('th.column_heading.pointer').live('hover', function(e) { PMA_changeClassForColumn($(this), 'hover', e.type == 'mouseenter'); }); /** * vertical column marking in horizontal mode when clicking the column header */ - $('.column_heading.marker').live('click', function() { + $('th.column_heading.marker').live('click', function() { PMA_changeClassForColumn($(this), 'marked'); }); diff --git a/js/tbl_change.js b/js/tbl_change.js index d90a59833e..d5096ff755 100644 --- a/js/tbl_change.js +++ b/js/tbl_change.js @@ -228,7 +228,7 @@ function verificationsAfterFieldChange(urlField, multi_edit, theType) */ $(document).ready(function() { - $('.open_gis_editor').live('click', function(event) { + $('span.open_gis_editor').live('click', function(event) { event.preventDefault(); var $span = $(this); @@ -261,7 +261,7 @@ $(document).ready(function() { }); // these were hidden via the "hide" class - $('.foreign_values_anchor').show(); + $('a.foreign_values_anchor').show(); /** * Handles all current checkboxes for Null; this only takes care of the @@ -269,7 +269,7 @@ $(document).ready(function() { * "Continue insertion" are handled in the "Continue insertion" code * */ - $('.checkbox_null').bind('click', function(e) { + $('input.checkbox_null').bind('click', function(e) { nullify( // use hidden fields populated by tbl_change.php $(this).siblings('.nullify_code').val(), @@ -287,9 +287,10 @@ $(document).ready(function() { * available). */ $('select[name="submit_type"]').bind('change', function (e) { - var auto_increment_column = $('.insertRowTable').find('input[name^="auto_increment"]').attr('name'); - var prev_value_field = $('.insertRowTable').find('input[name="' + auto_increment_column.replace('auto_increment', 'fields_prev') + '"]'); - var value_field = $('.insertRowTable').find('input[name="' + auto_increment_column.replace('auto_increment', 'fields') + '"]'); + var $table = $('table.insertRowTable'); + var auto_increment_column = $table.find('input[name^="auto_increment"]').attr('name'); + var prev_value_field = $table.find('input[name="' + auto_increment_column.replace('auto_increment', 'fields_prev') + '"]'); + var value_field = $table.find('input[name="' + auto_increment_column.replace('auto_increment', 'fields') + '"]'); if (auto_increment_column) { var previous_value = $(prev_value_field).val(); @@ -380,14 +381,14 @@ $(document).ready(function() { /** * @var curr_rows Number of current insert rows already on page */ - var curr_rows = $(".insertRowTable").length; + var curr_rows = $("table.insertRowTable").length; /** * @var target_rows Number of rows the user wants */ var target_rows = $("#insert_rows").val(); // remove all datepickers - $('.datefield,.datetimefield').each(function(){ + $('input.datefield, input.datetimefield').each(function(){ $(this).datepicker('destroy'); }); @@ -494,7 +495,7 @@ $(document).ready(function() { //Insert/Clone the ignore checkboxes if(curr_rows == 1 ) { $('') - .insertBefore(".insertRowTable:last") + .insertBefore("table.insertRowTable:last") .after(''); } else { @@ -519,7 +520,7 @@ $(document).ready(function() { .clone() .attr('for', new_name) .before('
') - .insertBefore(".insertRowTable:last"); + .insertBefore("table.insertRowTable:last"); } curr_rows++; } @@ -534,13 +535,13 @@ $(document).ready(function() { // update the IDs of textfields to ensure that they are unique $(this).attr('id', "field_" + tabindex + "_3"); }); - $('.control_at_footer') + $('select.control_at_footer') .each(function() { tabindex++; $(this).attr('tabindex', tabindex); }); // Add all the required datepickers back - $('.datefield,.datetimefield').each(function(){ + $('input.datefield, input.datetimefield').each(function(){ PMA_addDatepicker($(this)); }); } diff --git a/js/tbl_gis_visualization.js b/js/tbl_gis_visualization.js index f60099e505..e43a267db5 100644 --- a/js/tbl_gis_visualization.js +++ b/js/tbl_gis_visualization.js @@ -61,7 +61,7 @@ function selectVisualization() { } else { $('#placeholder').hide(); } - $('.choice').show(); + $('#choice').show(); } /** @@ -125,7 +125,7 @@ function resizeGISVisualization() { var old_width = $placeholder.width(); var extraPadding = 100; - var leftWidth = $('.gis_table').width(); + var leftWidth = $('table.gis_table').width(); var windowWidth = document.documentElement.clientWidth; var visWidth = windowWidth - extraPadding - leftWidth; @@ -172,7 +172,7 @@ function initGISVisualization() { $(document).ready(function() { // If we are in GIS visualization, initialize it - if ($('.gis_table').length > 0) { + if ($('table.gis_table').length > 0) { initGISVisualization(); } diff --git a/js/tbl_relation.js b/js/tbl_relation.js index 74cb4092ef..b11380787d 100644 --- a/js/tbl_relation.js +++ b/js/tbl_relation.js @@ -17,11 +17,11 @@ function show_hide_clauses(thisDropdown) $(document).ready(function() { // initial display - $('.referenced_column_dropdown').each(function(index, one_dropdown) { + $('select.referenced_column_dropdown').each(function(index, one_dropdown) { show_hide_clauses($(one_dropdown)); }); // change - $('.referenced_column_dropdown').change(function() { + $('select.referenced_column_dropdown').change(function() { show_hide_clauses($(this)); }); }); diff --git a/js/tbl_select.js b/js/tbl_select.js index 87dee553a0..c97c1689d1 100644 --- a/js/tbl_select.js +++ b/js/tbl_select.js @@ -86,9 +86,9 @@ $(document).ready(function() { // Following section is related to the 'function based search' for geometry data types. // Initialy hide all the open_gis_editor spans - $('.open_search_gis_editor').hide(); + $('span.open_search_gis_editor').hide(); - $('.geom_func').bind('change', function() { + $('select.geom_func').bind('change', function() { var $geomFuncSelector = $(this); var binaryFunctions = [ @@ -136,7 +136,7 @@ $(document).ready(function() { } // if the chosen function's output is a geometry, enable GIS editor - var $editorSpan = $geomFuncSelector.parents('tr').find('.open_search_gis_editor'); + var $editorSpan = $geomFuncSelector.parents('tr').find('span.open_search_gis_editor'); if ($.inArray($geomFuncSelector.val(), outputGeomFunctions) >= 0){ $editorSpan.show(); } else { @@ -145,7 +145,7 @@ $(document).ready(function() { }); - $('.open_search_gis_editor').live('click', function(event) { + $('span.open_search_gis_editor').live('click', function(event) { event.preventDefault(); var $span = $(this); diff --git a/js/tbl_structure.js b/js/tbl_structure.js index 7c8ff8a727..0b997019bc 100644 --- a/js/tbl_structure.js +++ b/js/tbl_structure.js @@ -25,7 +25,7 @@ $(document).ready(function() { * @uses PMA_ajaxShowMessage() * (see $GLOBALS['cfg']['AjaxEnable']) */ - $(".drop_column_anchor").live('click', function(event) { + $("a.drop_column_anchor").live('click', function(event) { event.preventDefault(); /** @@ -81,7 +81,7 @@ $(document).ready(function() { * @uses PMA_ajaxShowMessage() * (see $GLOBALS['cfg']['AjaxEnable']) */ - $(".action_primary a").live('click', function(event) { + $("div.action_primary a").live('click', function(event) { event.preventDefault(); /** @@ -123,7 +123,7 @@ $(document).ready(function() { * @uses PMA_ajaxShowMessage() * (see $GLOBALS['cfg']['AjaxEnable']) */ - $('.drop_primary_key_index_anchor').live('click', function(event) { + $('a.drop_primary_key_index_anchor').live('click', function(event) { event.preventDefault(); $anchor = $(this); @@ -153,7 +153,7 @@ $(document).ready(function() { if ($rows_to_hide.length == $table_ref.find('tbody > tr').length) { // We are about to remove all rows from the table $table_ref.hide('medium', function() { - $('.no_indexes_defined').show('medium'); + $('div.no_indexes_defined').show('medium'); $rows_to_hide.remove(); }); $table_ref.siblings('div.notice').hide('medium'); @@ -270,7 +270,7 @@ $(document).ready(function() { if ($("#edit_index_dialog").length > 0) { $("#edit_index_dialog").dialog("close"); } - $('.no_indexes_defined').hide(); + $('div.no_indexes_defined').hide(); } else if (data.error != undefined) { var $temp_div = $("
").append(data.error); if ($temp_div.find(".error code").length != 0) { @@ -328,7 +328,7 @@ $(document).ready(function() { $(this).closest("tr").find("input").focus(); }); // Focus the slider, otherwise it looks nearly transparent - $('.ui-slider-handle').addClass('ui-state-focus'); + $('a.ui-slider-handle').addClass('ui-state-focus'); // set focus on index name input, if empty var input = $div.find('input#input_index_name'); input.val() || input.focus();