admin.js
42 lines
| 1 | jQuery(document).ready(function($){ |
| 2 | |
| 3 | $('.acfe_modal').dialog({ |
| 4 | title: 'Data', |
| 5 | dialogClass: 'wp-dialog', |
| 6 | autoOpen: false, |
| 7 | draggable: false, |
| 8 | width: 'auto', |
| 9 | modal: true, |
| 10 | resizable: false, |
| 11 | closeOnEscape: true, |
| 12 | position: { |
| 13 | my: "center", |
| 14 | at: "center", |
| 15 | of: window |
| 16 | }, |
| 17 | open: function(){ |
| 18 | $('.ui-widget-overlay').bind('click', function(){ |
| 19 | $('.acfe_modal').dialog('close'); |
| 20 | }) |
| 21 | }, |
| 22 | create: function(){ |
| 23 | $('.ui-dialog-titlebar-close').addClass('ui-button'); |
| 24 | }, |
| 25 | }); |
| 26 | |
| 27 | $('.button.edit-field').each(function(k, v){ |
| 28 | var tbody = $(this).closest('tbody'); |
| 29 | $(tbody).find('.acfe_modal_open:first').insertAfter($(this)); |
| 30 | $(tbody).find('tr.acf-field-setting-acfe_field_data:first').remove(); |
| 31 | }); |
| 32 | |
| 33 | $('.acfe_modal_open').click(function(e){ |
| 34 | e.preventDefault(); |
| 35 | |
| 36 | var key = $(this).attr('data-modal-key'); |
| 37 | console.log(key); |
| 38 | $('.acfe_modal[data-modal-key=' + key + ']').dialog('open'); |
| 39 | |
| 40 | }); |
| 41 | |
| 42 | }); |