1// IIFE 2(function($, window, document) { 3 4 // $ is now locally scoped and available 5 6 $(function() { 7 8 // DOM is now ready 9 10 'use strict'; 11 12 //Init all the suggest autocomplete fields 13 $(document).ready(function() { 14 mpca_setup_clipboardjs(); 15 16 $('.mepr_suggest_user').suggest( 17 mpcaAjax.ajaxurl + '?action=mepr_user_search', { 18 delay: 500, 19 minchars: 2 20 } 21 ); 22 }); 23 24 $('#mpca_import_sub_accounts form').on('submit', function(e) { 25 $('.mpca-loading-gif').show(); 26 $('#mpca_import_sub_accounts form input[type=submit]').attr('disabled',true); 27 }); 28 29 function search() { 30 var href = window.location.href.replace(/([\?&])search=[^\?&]*/gi,''); 31 href = href.replace(/([\?&])currpage=[^\?&]*/gi,''); 32 var delim = href.match(/\?/) ? '&' : '?', 33 term = $('#mpca_sub_account_search').val(); 34 35 if(term) { 36 window.location.href = href + delim + 'search=' + term; 37 } 38 else { 39 window.location.href = href; 40 } 41 } 42 43 $('#mpca_sub_account_search').on('keyup',function(e) { 44 if(e.which == 13) { 45 e.preventDefault(); 46 search(); 47 } 48 }); 49 50 $('#mpca_sub_account_search_btn').click(function() { 51 search(); 52 }); 53 54 $('.mpca-remove-sub-account').on('click', function(e) { 55 e.preventDefault(); 56 57 if(confirm(mpcaAjax.confirmMsg)) { 58 var args = { 59 'action': 'mpca_remove_sub_account', 60 '_wpnonce': mpcaAjax.nonce, 61 'ca': $(this).data('ca'),
62 'sa': $(this).data('sa') 63 }; 64 65 $.post(mpcaAjax.ajaxurl,args,function() { 66 //$('#mpca-sub-accounts-row-'+args.sa).remove(); 67 // Fixes reload problem with Chrome 68 window.location.replace(location.href); 69 }); 70 } 71 }); 72 73 $('#mpca-add-sub-user-btn').click(function() { 74 jQuery('#mpca-add-sub-user-form').slideToggle(); 75 }); 76 77 $('#mpca_export_sub_accounts button').on('click', function(e) { 78 e.preventDefault(); 79 window.location.href = $(this).data('href'); 80 }); 81 82 $('.mpca-make-parent').on('click', function(e) { 83 e.preventDefault(); 84 85 if(confirm(mpcaAjax.changeConfirmMsg)) { 86 var args = { 87 'action': 'mpca_switch_corporate_account_holder', 88 '_wpnonce': mpcaAjax.nonce, 89 'ca': $(this).data('ca'), 90 'sa': $(this).data('sa') 91 }; 92 93 $.post(mpcaAjax.ajaxurl, args) 94 .done(function (response) { 95 if (response && typeof response.success === 'boolean') { 96 if (response.success) { 97 // Fixes reload problem with Chrome 98 window.location.replace(window.location.href); 99 } else { 100 alert(response.data); 101 } 102 } 103 else { 104 alert('Invalid response'); 105 } 106 }) 107 .fail(function () { 108 alert('Request failed'); 109 }); 110 } 111 }); 112 }); 113}(jQuery, window, document));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.