script.js
37 lines
| 1 | (function ($) { |
| 2 | $(document).ready(function () { |
| 3 | /* add notice about changing in the settings page */ |
| 4 | $(document).on('click', '.rewrite_item_add_btn', 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_item_delete_btn').removeClass('rewrite_item_add_btn'); |
| 10 | $(this).children('.dashicons').addClass('dashicons-trash').removeClass('dashicons-plus-alt2'); |
| 11 | } else { |
| 12 | $(this).next().show(); |
| 13 | } |
| 14 | }); |
| 15 | }); |
| 16 | |
| 17 | $(document).on('click', '.rewrite_item_delete_btn', function () { |
| 18 | $(this).each(function () { |
| 19 | $(this).parent().remove(); |
| 20 | }); |
| 21 | }); |
| 22 | |
| 23 | // Toggle merge tag hints |
| 24 | $(document).on('click', 'a.ehssl-toggle', function (e) { |
| 25 | e.preventDefault(); |
| 26 | var div = $(this).siblings('div'); |
| 27 | if (div.is(':visible')) { |
| 28 | $(this).removeClass('toggled-on'); |
| 29 | $(this).addClass('toggled-off'); |
| 30 | } else { |
| 31 | $(this).removeClass('toggled-off'); |
| 32 | $(this).addClass('toggled-on'); |
| 33 | } |
| 34 | div.slideToggle('fast'); |
| 35 | }); |
| 36 | }); |
| 37 | })(jQuery); |