(operate ($) {
‘use strict’;
var ring = new Audio;
var prv_id;
var prv_button;
$(doc).on('click on', '.play-btn', operate () {
var button = $(this);
var post_id = button.attr('data-post-id');
if (prv_id == post_id) {
if (ring.paused) {
button.addClass('pause');
ring.play()
} else {
ring.pause();
prv_button.removeClass('pause');
}
return false;
}
if (prv_id) {
button.removeClass('spinner');
ring.pause();
prv_button.removeClass('pause');
}
prv_button = button;
prv_id = post_id;
if (post_id !== '') {
$.ajax({
kind: 'POST',
url: "/wp-admin/admin-ajax.php",
information: {
motion: 'ringtone_url',
post_id: post_id,
},
beforeSend: operate () {
button.addClass('spinner');
},
success: operate (response) {
button.removeClass('spinner');
button.addClass('pause');
ring.src = response;
ring.play()
}
});
}
return false;
});
ring.onended = operate () {
prv_button.removeClass('pause');
};
})(jQuery);
give me operate.php code