| 1 |
jQuery(document).ready(function() { |
| 2 |
jQuery(window).resize(function() { |
| 3 |
jQuery('.wp-insert .plugin-card').each(function() { |
| 4 |
jQuery(this).css('height', 'auto'); |
| 5 |
}); |
| 6 |
jQuery('.wp-insert .plugin-card').each(function() { |
| 7 |
var initialCard = jQuery(this); |
| 8 |
var rowTop = initialCard.position().top; |
| 9 |
jQuery('.wp-insert .plugin-card').each(function() { |
| 10 |
if(rowTop == jQuery(this).position().top) { |
| 11 |
if(initialCard.height() < jQuery(this).height()) { |
| 12 |
initialCard.height(jQuery(this).height()); |
| 13 |
} |
| 14 |
} |
| 15 |
}); |
| 16 |
}); |
| 17 |
}); |
| 18 |
jQuery(window).resize(); |
| 19 |
|
| 20 |
wp_insert_click_handler( |
| 21 |
'wp_insert_abtesting_configuration', |
| 22 |
'Multiple Ad Networks / A-B Testing : Configuration', |
| 23 |
'480', |
| 24 |
'480', |
| 25 |
function() { }, |
| 26 |
function() { |
| 27 |
jQuery.post( |
| 28 |
jQuery('#wp_insert_admin_ajax').val(), { |
| 29 |
'action': "wp_insert_abtesting_configuration_form_save_action", |
| 30 |
'wp_insert_nonce': jQuery('#wp_insert_nonce').val(), |
| 31 |
'wp_insert_abtesting_mode': jQuery('input[name=wp_insert_abtesting_mode]:checked').val() |
| 32 |
}, function(response) { } |
| 33 |
); |
| 34 |
}, |
| 35 |
function() { } |
| 36 |
); |
| 37 |
}); |
| 38 |
|
| 39 |
function wp_insert_click_handler(target, title, width, height, openAction, UpdateAction, closeAction) { |
| 40 |
jQuery('#'+target).click(function() { |
| 41 |
jQuery('<div id="'+target+'_dialog"></div>').html('<div class="wp_insert_ajaxloader"></div>').dialog({ |
| 42 |
'modal': true, |
| 43 |
'resizable': false, |
| 44 |
'width': width, |
| 45 |
'maxWidth': width, |
| 46 |
'maxHeight': height, |
| 47 |
'title': title, |
| 48 |
position: { my: 'center', at: 'center', of: window }, |
| 49 |
open: function (event, ui) { |
| 50 |
jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'}); |
| 51 |
jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'}); |
| 52 |
jQuery('.ui-dialog-buttonpane button:contains("Update")').button('disable'); |
| 53 |
|
| 54 |
jQuery.post( |
| 55 |
jQuery('#wp_insert_admin_ajax').val(), { |
| 56 |
'action': target+'_form_get_content', |
| 57 |
'wp_insert_nonce': jQuery('#wp_insert_nonce').val() |
| 58 |
}, function(response) { |
| 59 |
jQuery('.wp_insert_ajaxloader').hide(); |
| 60 |
jQuery('.ui-dialog-content').html(response); |
| 61 |
jQuery('.ui-accordion .ui-accordion-content').css('max-height', (jQuery("body").height() * 0.45)); |
| 62 |
jQuery('.ui-dialog-buttonpane button:contains("Update")').button('enable'); |
| 63 |
openAction(); |
| 64 |
jQuery('.ui-dialog').css({'position': 'fixed'}); |
| 65 |
jQuery('#'+target+'_dialog').delay(500).dialog({position: { my: 'center', at: 'center', of: window }}); |
| 66 |
|
| 67 |
} |
| 68 |
); |
| 69 |
}, |
| 70 |
buttons: { |
| 71 |
'Update': { |
| 72 |
text: 'Update', |
| 73 |
icons: { primary: "ui-icon-gear" }, |
| 74 |
click: function() { |
| 75 |
if(UpdateAction() != 'false') { |
| 76 |
jQuery(this).dialog('close'); |
| 77 |
} |
| 78 |
} |
| 79 |
}, |
| 80 |
Cancel: { |
| 81 |
text: 'Cancel', |
| 82 |
icons: { primary: "ui-icon-cancel" }, |
| 83 |
click: function() { |
| 84 |
if(closeAction() != 'false') { |
| 85 |
jQuery(this).dialog('close'); |
| 86 |
} |
| 87 |
} |
| 88 |
} |
| 89 |
}, |
| 90 |
close: function() { |
| 91 |
closeAction(); |
| 92 |
jQuery(this).dialog('destroy'); |
| 93 |
} |
| 94 |
}) |
| 95 |
}); |
| 96 |
} |