script.js
22 lines
| 1 | (function($) { |
| 2 | $(document).ready( function() { |
| 3 | /* add notice about changing in the settings page */ |
| 4 | $( document ).on( 'click', '.rewrite_add_item', function(){ |
| 5 | $(this).each( function(){ |
| 6 | if( $( this ).prev().val() != '' ){ |
| 7 | $( this ).next().hide(); |
| 8 | $( this ).parents( '.rewrite_new_item' ).removeClass( 'rewrite_new_item' ).clone().addClass( 'rewrite_new_item' ).appendTo( $( this ).parents( "td" ) ).find( 'input' ).val( '' ); |
| 9 | $( this ).addClass( 'rewrite_delete_item' ).removeClass( 'rewrite_add_item' ); |
| 10 | } |
| 11 | else{ |
| 12 | $(this).next().show(); |
| 13 | } |
| 14 | }); |
| 15 | }); |
| 16 | $( document ).on( 'click', '.rewrite_delete_item', function(){ |
| 17 | $( this ).each( function(){ |
| 18 | $( this ).parent().remove(); |
| 19 | }); |
| 20 | }); |
| 21 | }); |
| 22 | })(jQuery); |