diff options
author | Rouslan Placella <rouslan@placella.com> | 2012-04-10 19:46:51 +0400 |
---|---|---|
committer | Rouslan Placella <rouslan@placella.com> | 2012-04-11 00:50:34 +0400 |
commit | 9c167049683d3a54f21e353dc87f3f22b912d00d (patch) | |
tree | 659f71eb0e43cd8fe399b23d7accf4b2073418f3 /js/gis_data_editor.js | |
parent | a753ac9b8031593f4d8390e004d9169a31ee0c6f (diff) |
Speed-up selectors
Diffstat (limited to 'js/gis_data_editor.js')
-rw-r--r-- | js/gis_data_editor.js | 33 |
1 files changed, 17 insertions, 16 deletions
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('<br><br>'); @@ -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('<a class="' + classes + '" name="' + $button.attr('name') - + '">+ ' + $button.val() + '</a>') - .remove(); + $button.replaceWith( + '<a class="' + classes + '" name="' + $button.attr('name') + + '">+ ' + $button.val() + '</a>' + ); }); } @@ -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 |