| 1 |
|
| 2 |
jQuery(document).ready(function() { |
| 3 |
jQuery(".loginizer-social-wrapper").sortable({ |
| 4 |
handle : '.loginizer-social-grip', |
| 5 |
placeholder : 'loginizer-sortable-placeholder', |
| 6 |
stop : loginizer_sort_social |
| 7 |
}); |
| 8 |
}); |
| 9 |
|
| 10 |
// Used to sort and save the order of Social Login Apps. |
| 11 |
function loginizer_sort_social(event, ui) { |
| 12 |
var target= jQuery(event.target), |
| 13 |
sortables = target.find('.loginizer-social-provider'), |
| 14 |
|
| 15 |
sorted_arr = sortables.map(function() { |
| 16 |
return jQuery(this).data('provider'); |
| 17 |
}).get(); |
| 18 |
|
| 19 |
// To show the saving order text. |
| 20 |
let saving_order = jQuery(ui.item).find('.loginizer-social-saving-order'); |
| 21 |
saving_order.show(); |
| 22 |
|
| 23 |
jQuery.ajax({ |
| 24 |
method : 'POST', |
| 25 |
url : loginizer_social.ajax_url, |
| 26 |
data : { |
| 27 |
security: loginizer_social.nonce, |
| 28 |
order: sorted_arr, |
| 29 |
action: 'loginizer_social_order' |
| 30 |
}, |
| 31 |
success: function(res){ |
| 32 |
saving_order.hide(); |
| 33 |
}} |
| 34 |
); |
| 35 |
} |