var PODLOVE = PODLOVE || {};
/**
* Handles all logic in Create/Edit Episode screen.
*
* @todo investigate: looks like there is trouble when a second UARJob is started while the first is still running.
*/
(function($){
PODLOVE.Jobs = function() {};
PODLOVE.Jobs.create = function(name, args, callback) {
$.post(ajaxurl, {
action: 'podlove-job-create',
name: name,
args: args
}, 'json').done(function(job) {
// console.log("create job done", job);
if (callback) {
callback(job);
}
});
};
PODLOVE.Jobs.getStatus = function(job_id, callback) {
$.getJSON(ajaxurl, {
action: 'podlove-job-get',
job_id: job_id
}).done(function(status) {
// console.log("job status", job);
if (callback) {
callback(status);
}
});
}
PODLOVE.Jobs.Tools = function() {};
PODLOVE.Jobs.Tools.init = function() {
var wrapper = $(this)
var job_name = wrapper.data('job')
var button_text = wrapper.data('button-text')
var job_id = null;
var recent_job_id = wrapper.data('recent-job-id')
var job_args = wrapper.data('args') || {}
var timer = null;
var spinner = $("");
var button = $("